Skip to content
Advertisement

Python urllib3.exceptions.NewConnectionError connecting to self-built API

I’ve built an API (with flask-restful) that stores data in its cache and exposes it to other applications. When I try to send a get request to this API from another app (also flask) it returns the following error

JavaScript

I thought that this error occurred because I was sending too many requests with the same url to the API. I had then limited the number of API calls by adding decorators = [index.limiter.limit("60/minute")] to the API. The error still persisted however. Then I thought the error might be caused by the amount of calls accepted by the server. I thought I was not closing the connection properly after making an API call. So I added

JavaScript

But this also did not solve my issue. What am I missing here? I am using python3.8

EDIT: I found out that it’s not per se the query that is causing it, because if I try other queries, then the same message pops up. I’m still lost at how to debug this :/

Advertisement

Answer

The error says: “Name or service not known”. In other words, it’s a name resolution issue (DNS).

Cross check the target host (“data-collector.cloud”, which isn’t in the public DNS records.)

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement