Kenny Ho Kenny Ho - 10 months ago 53
Python Question

503 Reponse when trying to use python request on local website

I'm trying to scrape my own site from my local server. But when I use python requests on it, it gives me a response 503. Other ordinary sites on the web work. Any reason/solution for this?

import requests
url = ''

r = requests.get(url)

print r

prints out

<Response [503]>

After further investigation, I've found a similar problem to mine.
Python requests 503 erros when trying to access localhost:8000

However, I don't think he's solved it yet. I can access the local website via the web browser but can't access using the requests.get function. I'm also using Django to host the server.

python runserver 8080

When I use:
curl -vvv

* Rebuilt URL to:
* Trying
* Connected to proxy.kdc.[company-name].com ( port 8099 (#0)
* Proxy auth using Basic with user '[company-id]'
> GET HTTP/1.1
> Host:
> Proxy-Authorization: Basic Y2FhNTc2OnJ2YTkxQ29kZQ==
> User-Agent: curl/7.49.0
> Accept: */*
< HTTP/1.1 301 Moved Permanently
< Server: BlueCoat-Security-Appliance
< Location:
< Connection: Close
* Closing connection 0

Answer Source

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.