7 months ago
Sorry if its a dumb question but im new and testing out railway.
I made a simple flask app to pull some data from the binance:
def getfundingrate():
url = 'https://fapi.binance.com/fapi/v1/fundingRate?symbol=BTCUSDT&limit=100'
response = requests.get(url)
if response.status_code == 200:
return response.json()
return None
Run locally its fine, but whenever i deploy to railway, it cannot communicate with the api, what do i need to do to communicate with an external api?
0 Replies
yes, i added some simple code to ping the api:
@app.route('/section2/testapi') def testapi():
response = requests.get('https://api.binance.com/api/v3/ping')
if response.statuscode == 200: return "API is reachable", 200 else: return "Error reaching API", response.statuscode
When run locally i get this: API is reachable
When run on railway i get this: Error reaching API
7 months ago
binance is known to block GCP IP addresses, we run a large portion of workloads on GCP by default.
Please try switching to one of our two metal regions in your service settings.
7 months ago
what status code do you get
7 months ago
that's not something we could help with unfortunately