503 Reponse when trying to use python request on local website
I cannot request a local url using python requests because the company's network software won't allow it. This is a dead end and other avenues must be pursued.
EDIT: Working Solution
>>> import requests>>> session = requests.Session()>>> session.trust_env = False>>> r = session.get("http://127.0.0.1:8080")>>> r<Response [200]>
Maybe you should disable your proxies in your requests.
import requestsproxies = { "http": None, "https": None,}requests.get("http://127.0.0.1:8080/myfunction", proxies=proxies)
ref:
HTTP Error 503 means:
The Web server (running the Web site) is currently unable to handle the HTTP request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. Some servers in this state may also simply refuse the socket connection, in which case a different error may be generated because the socket creation timed out.
You may do following things:
- Check you are able to open URL in the browser
- If URL is opening, then check the domain in your code, it might be incorrect.
- If in browser also it is not opening, your site may be overloaded or server resources are full to perform request