debug.py 759 B

123456789101112131415161718
  1. import os, requests, json
  2. api_key = os.getenv("APIYI_KEY")
  3. video_id = "video_8dbef289-ea55-418a-a8f8-17c6f4304653"
  4. headers = {"Authorization": api_key}
  5. # Check status
  6. r = requests.get(f"https://api.apiyi.com/v1/videos/{video_id}", headers=headers)
  7. with open("tests/output/status_response.json", "w", encoding="utf-8") as f:
  8. json.dump({"status_code": r.status_code, "response": r.json()}, f, indent=2, ensure_ascii=False)
  9. # Try content endpoint
  10. r2 = requests.get(f"https://api.apiyi.com/v1/videos/{video_id}/content", headers=headers)
  11. with open("tests/output/content_response.json", "w", encoding="utf-8") as f:
  12. json.dump({"status_code": r2.status_code, "text": r2.text}, f, indent=2, ensure_ascii=False)
  13. print("Responses saved to tests/output/")