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