How to determine if api service is blocking requests from VPS
This works from my development machine (MacOS):
import requests
r=requests.get('http://api.usno.navy.mil/rstt/oneday?date=today&loc=Sacramento,CA')
But not from my VPS (Ubuntu LTS). From the VPS I get:
requests.exceptions.ConnectionError: HTTPConnectionPool(host='api.usno.navy.mil', port=80): Max retries exceeded with url: /rstt/oneday?date=today&loc=Sacramento,CA (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 110] Connection timed out',))
Same version of Python (3.6) and requests (2.20.1) on both systems.
"Max retries exceeded with url:" is clearly not the problem, since I can access it from the MacOS machine.
How can I get requests to provide more information, such as determine if the IP of my VPS is being blocked from the API provider?
I am able to access http://www.airnowapi.org and https://api.weather.gov from both systems and receive a 200 status.
python-3.x python-requests digital-ocean
add a comment |
This works from my development machine (MacOS):
import requests
r=requests.get('http://api.usno.navy.mil/rstt/oneday?date=today&loc=Sacramento,CA')
But not from my VPS (Ubuntu LTS). From the VPS I get:
requests.exceptions.ConnectionError: HTTPConnectionPool(host='api.usno.navy.mil', port=80): Max retries exceeded with url: /rstt/oneday?date=today&loc=Sacramento,CA (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 110] Connection timed out',))
Same version of Python (3.6) and requests (2.20.1) on both systems.
"Max retries exceeded with url:" is clearly not the problem, since I can access it from the MacOS machine.
How can I get requests to provide more information, such as determine if the IP of my VPS is being blocked from the API provider?
I am able to access http://www.airnowapi.org and https://api.weather.gov from both systems and receive a 200 status.
python-3.x python-requests digital-ocean
1
Max retries exceeded with url: ...
is the libraries way of saying "I've tried to create a connection to the server a couple of times, but never succeeded". So you can't say it's "clearly not the problem". Could be a lot of reasons, maybe a firewall interfering with outgoing connections, network problem, ...
– mata
Nov 14 '18 at 20:45
Under the hoodrequests
tries multiple times. That's why you are getting the wordingMax retries exceeded with url
. Try to userequests
to access other URLs from other services. If you are getting the same error, then it might be a firewall issue or similar. If not then the timeout error is your client telling you that you are blocked. To go around this you need something like a proxy service, or get a new IP, or the like.
– André C. Andersen
Nov 14 '18 at 21:22
Added: "I am able to access airnowapi.org and api.weather.gov from both systems and receive a 200 status"
– BridgeGuy
Nov 14 '18 at 21:48
Perfect. Then you're good to go. When you getrequests.exceptions.ConnectionError
you are blocked bynavy.mil
or your ISP for that particular service. Use a proxy service. I recommend crawlera. No affiliation, just like them. One IP and it rotates proxies for you.
– André C. Andersen
Nov 14 '18 at 22:13
add a comment |
This works from my development machine (MacOS):
import requests
r=requests.get('http://api.usno.navy.mil/rstt/oneday?date=today&loc=Sacramento,CA')
But not from my VPS (Ubuntu LTS). From the VPS I get:
requests.exceptions.ConnectionError: HTTPConnectionPool(host='api.usno.navy.mil', port=80): Max retries exceeded with url: /rstt/oneday?date=today&loc=Sacramento,CA (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 110] Connection timed out',))
Same version of Python (3.6) and requests (2.20.1) on both systems.
"Max retries exceeded with url:" is clearly not the problem, since I can access it from the MacOS machine.
How can I get requests to provide more information, such as determine if the IP of my VPS is being blocked from the API provider?
I am able to access http://www.airnowapi.org and https://api.weather.gov from both systems and receive a 200 status.
python-3.x python-requests digital-ocean
This works from my development machine (MacOS):
import requests
r=requests.get('http://api.usno.navy.mil/rstt/oneday?date=today&loc=Sacramento,CA')
But not from my VPS (Ubuntu LTS). From the VPS I get:
requests.exceptions.ConnectionError: HTTPConnectionPool(host='api.usno.navy.mil', port=80): Max retries exceeded with url: /rstt/oneday?date=today&loc=Sacramento,CA (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 110] Connection timed out',))
Same version of Python (3.6) and requests (2.20.1) on both systems.
"Max retries exceeded with url:" is clearly not the problem, since I can access it from the MacOS machine.
How can I get requests to provide more information, such as determine if the IP of my VPS is being blocked from the API provider?
I am able to access http://www.airnowapi.org and https://api.weather.gov from both systems and receive a 200 status.
python-3.x python-requests digital-ocean
python-3.x python-requests digital-ocean
edited Nov 14 '18 at 21:48
BridgeGuy
asked Nov 14 '18 at 20:23
BridgeGuyBridgeGuy
12
12
1
Max retries exceeded with url: ...
is the libraries way of saying "I've tried to create a connection to the server a couple of times, but never succeeded". So you can't say it's "clearly not the problem". Could be a lot of reasons, maybe a firewall interfering with outgoing connections, network problem, ...
– mata
Nov 14 '18 at 20:45
Under the hoodrequests
tries multiple times. That's why you are getting the wordingMax retries exceeded with url
. Try to userequests
to access other URLs from other services. If you are getting the same error, then it might be a firewall issue or similar. If not then the timeout error is your client telling you that you are blocked. To go around this you need something like a proxy service, or get a new IP, or the like.
– André C. Andersen
Nov 14 '18 at 21:22
Added: "I am able to access airnowapi.org and api.weather.gov from both systems and receive a 200 status"
– BridgeGuy
Nov 14 '18 at 21:48
Perfect. Then you're good to go. When you getrequests.exceptions.ConnectionError
you are blocked bynavy.mil
or your ISP for that particular service. Use a proxy service. I recommend crawlera. No affiliation, just like them. One IP and it rotates proxies for you.
– André C. Andersen
Nov 14 '18 at 22:13
add a comment |
1
Max retries exceeded with url: ...
is the libraries way of saying "I've tried to create a connection to the server a couple of times, but never succeeded". So you can't say it's "clearly not the problem". Could be a lot of reasons, maybe a firewall interfering with outgoing connections, network problem, ...
– mata
Nov 14 '18 at 20:45
Under the hoodrequests
tries multiple times. That's why you are getting the wordingMax retries exceeded with url
. Try to userequests
to access other URLs from other services. If you are getting the same error, then it might be a firewall issue or similar. If not then the timeout error is your client telling you that you are blocked. To go around this you need something like a proxy service, or get a new IP, or the like.
– André C. Andersen
Nov 14 '18 at 21:22
Added: "I am able to access airnowapi.org and api.weather.gov from both systems and receive a 200 status"
– BridgeGuy
Nov 14 '18 at 21:48
Perfect. Then you're good to go. When you getrequests.exceptions.ConnectionError
you are blocked bynavy.mil
or your ISP for that particular service. Use a proxy service. I recommend crawlera. No affiliation, just like them. One IP and it rotates proxies for you.
– André C. Andersen
Nov 14 '18 at 22:13
1
1
Max retries exceeded with url: ...
is the libraries way of saying "I've tried to create a connection to the server a couple of times, but never succeeded". So you can't say it's "clearly not the problem". Could be a lot of reasons, maybe a firewall interfering with outgoing connections, network problem, ...– mata
Nov 14 '18 at 20:45
Max retries exceeded with url: ...
is the libraries way of saying "I've tried to create a connection to the server a couple of times, but never succeeded". So you can't say it's "clearly not the problem". Could be a lot of reasons, maybe a firewall interfering with outgoing connections, network problem, ...– mata
Nov 14 '18 at 20:45
Under the hood
requests
tries multiple times. That's why you are getting the wording Max retries exceeded with url
. Try to use requests
to access other URLs from other services. If you are getting the same error, then it might be a firewall issue or similar. If not then the timeout error is your client telling you that you are blocked. To go around this you need something like a proxy service, or get a new IP, or the like.– André C. Andersen
Nov 14 '18 at 21:22
Under the hood
requests
tries multiple times. That's why you are getting the wording Max retries exceeded with url
. Try to use requests
to access other URLs from other services. If you are getting the same error, then it might be a firewall issue or similar. If not then the timeout error is your client telling you that you are blocked. To go around this you need something like a proxy service, or get a new IP, or the like.– André C. Andersen
Nov 14 '18 at 21:22
Added: "I am able to access airnowapi.org and api.weather.gov from both systems and receive a 200 status"
– BridgeGuy
Nov 14 '18 at 21:48
Added: "I am able to access airnowapi.org and api.weather.gov from both systems and receive a 200 status"
– BridgeGuy
Nov 14 '18 at 21:48
Perfect. Then you're good to go. When you get
requests.exceptions.ConnectionError
you are blocked by navy.mil
or your ISP for that particular service. Use a proxy service. I recommend crawlera. No affiliation, just like them. One IP and it rotates proxies for you.– André C. Andersen
Nov 14 '18 at 22:13
Perfect. Then you're good to go. When you get
requests.exceptions.ConnectionError
you are blocked by navy.mil
or your ISP for that particular service. Use a proxy service. I recommend crawlera. No affiliation, just like them. One IP and it rotates proxies for you.– André C. Andersen
Nov 14 '18 at 22:13
add a comment |
1 Answer
1
active
oldest
votes
Be aware that on November 20, 2018 they have updated their api to version 2.2 which now uses HTTPS. Might want to update your URL to reflect that change.r=requests.get('https://api.usno.navy.mil/rstt/oneday?date=today&loc=Sacramento,CA')
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53308205%2fhow-to-determine-if-api-service-is-blocking-requests-from-vps%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Be aware that on November 20, 2018 they have updated their api to version 2.2 which now uses HTTPS. Might want to update your URL to reflect that change.r=requests.get('https://api.usno.navy.mil/rstt/oneday?date=today&loc=Sacramento,CA')
add a comment |
Be aware that on November 20, 2018 they have updated their api to version 2.2 which now uses HTTPS. Might want to update your URL to reflect that change.r=requests.get('https://api.usno.navy.mil/rstt/oneday?date=today&loc=Sacramento,CA')
add a comment |
Be aware that on November 20, 2018 they have updated their api to version 2.2 which now uses HTTPS. Might want to update your URL to reflect that change.r=requests.get('https://api.usno.navy.mil/rstt/oneday?date=today&loc=Sacramento,CA')
Be aware that on November 20, 2018 they have updated their api to version 2.2 which now uses HTTPS. Might want to update your URL to reflect that change.r=requests.get('https://api.usno.navy.mil/rstt/oneday?date=today&loc=Sacramento,CA')
answered Nov 30 '18 at 20:42
kendrakendra
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53308205%2fhow-to-determine-if-api-service-is-blocking-requests-from-vps%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Max retries exceeded with url: ...
is the libraries way of saying "I've tried to create a connection to the server a couple of times, but never succeeded". So you can't say it's "clearly not the problem". Could be a lot of reasons, maybe a firewall interfering with outgoing connections, network problem, ...– mata
Nov 14 '18 at 20:45
Under the hood
requests
tries multiple times. That's why you are getting the wordingMax retries exceeded with url
. Try to userequests
to access other URLs from other services. If you are getting the same error, then it might be a firewall issue or similar. If not then the timeout error is your client telling you that you are blocked. To go around this you need something like a proxy service, or get a new IP, or the like.– André C. Andersen
Nov 14 '18 at 21:22
Added: "I am able to access airnowapi.org and api.weather.gov from both systems and receive a 200 status"
– BridgeGuy
Nov 14 '18 at 21:48
Perfect. Then you're good to go. When you get
requests.exceptions.ConnectionError
you are blocked bynavy.mil
or your ISP for that particular service. Use a proxy service. I recommend crawlera. No affiliation, just like them. One IP and it rotates proxies for you.– André C. Andersen
Nov 14 '18 at 22:13