Spaces:
Running
Running
Download test.py from Mowglibai96/BytePlus_Seedance: direct link, hf CLI and curl.
- Browser
- Download file 921 Bytes
-
https://huggingface.co/spaces/Mowglibai96/BytePlus_Seedance/resolve/main/test.py
- Command line
-
hf download hf://spaces/Mowglibai96/BytePlus_Seedance/test.py
-
curl -L -o test.py https://huggingface.co/spaces/Mowglibai96/BytePlus_Seedance/resolve/main/test.py
921 Bytes
| import os | |
| import requests | |
| # Get the API key | |
| api_key = os.environ.get("key", "") | |
| print(f"1. API Key loaded: {'Yes' if api_key else 'No'}") | |
| print(f"2. Key length: {len(api_key)}") | |
| print(f"3. First 4 chars: {api_key[:4] if api_key else 'None'}") | |
| # Try a simple request | |
| url = "https://ark.ap-southeast.bytepluses.com/api/v3/contents/generations/tasks" | |
| headers = { | |
| "Content-Type": "application/json", | |
| "Authorization": f"Bearer {api_key}" | |
| } | |
| # Minimal test data | |
| data = { | |
| "model": "seedance-1-5-pro-251215", | |
| "content": [ | |
| { | |
| "type": "text", | |
| "text": "test" | |
| } | |
| ] | |
| } | |
| print("\n4. Sending test request...") | |
| try: | |
| response = requests.post(url, headers=headers, json=data) | |
| print(f"5. Status code: {response.status_code}") | |
| print(f"6. Response: {response.text[:200]}") # First 200 chars | |
| except Exception as e: | |
| print(f"5. Error: {e}") | |
| print("\n7. Test complete") |