A newer version of the Streamlit SDK is available: 1.62.0
Cloudflare Workers Proxy for Binance Testnet
This proxy bypasses geo-restrictions (Error 451) when accessing Binance testnet from HuggingFace Spaces.
π― Quick Start
1. Deploy the Worker (15 minutes)
Follow the step-by-step guide in DEPLOYMENT_GUIDE.md
Summary:
- Sign up at workers.cloudflare.com (FREE, no credit card)
- Create a new Worker
- Copy code from
binance-testnet-proxy.js - Save and Deploy
- Copy your Worker URL
2. Configure HuggingFace Space
Add your Worker URL to HuggingFace Secrets:
- Go to your Space Settings β Repository Secrets
- Add new secret:
- Name:
BINANCE_TESTNET_PROXY_URL - Value:
https://your-worker.workers.dev
- Name:
- Restart the Space
3. Test Locally (Optional)
Before deploying to HuggingFace, test locally:
# Add to .env file
echo "BINANCE_TESTNET_PROXY_URL=https://your-worker.workers.dev" >> .env
# Run test script
python test_proxy.py
If all tests pass β , you're ready to deploy to HuggingFace!
π Free Tier Limits
- Requests: 100,000 per day (FREE)
- CPU Time: 50ms per request
- Workers: 30 deployed scripts
- Storage: 1GB total
For a single trading bot: These limits are more than enough!
π Security
- β You control the proxy code
- β API keys are not logged or stored
- β CORS protection limits access to your HuggingFace Spaces only
- β All traffic is encrypted (HTTPS)
π Files in This Directory
binance-testnet-proxy.js- The Cloudflare Worker codeDEPLOYMENT_GUIDE.md- Detailed deployment instructionsREADME.md- This file
π Need Help?
- Check the DEPLOYMENT_GUIDE.md for troubleshooting
- Review Cloudflare Workers docs: https://developers.cloudflare.com/workers/
- Check if your Worker is deployed correctly in the Cloudflare dashboard
β Success Checklist
- Cloudflare account created
- Worker deployed with proxy code
- Worker URL copied
-
BINANCE_TESTNET_PROXY_URLadded to HuggingFace Secrets - HuggingFace Space restarted
- Testnet tab working! π