Jump to content

Python 3 Requests Proxy Error

mattl1598

I'm working on my A-Level Computer Science Project part of which grabs data from the google books API. I have some working code which does this and I wrote into my program last year.

Over the summer, the school updated all of the computers to windows 10 and since then, the requests module is unable to connect to the API to get the data.

It shouldn't be the OS update since I run Windows 10 at home and it works just fine there. 

The error below indicates that it's a proxy issue which must be from the schools proxy filter for websites like youtube and facebook but they had the same filter last year and I can still view the data from the API by pasting the address into Chrome.

Does anyone know a workaround or solution that means the program can still grab the data?

 

Spoiler

Exception in Tkinter callback
Traceback (most recent call last):
  File "N:\A Level\python 3.6.6\lib\urllib3\connection.py", line 171, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "N:\A Level\python 3.6.6\lib\urllib3\util\connection.py", line 56, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "N:\A Level\python 3.6.6\lib\socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11003] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "N:\A Level\python 3.6.6\lib\urllib3\connectionpool.py", line 594, in urlopen
    self._prepare_proxy(conn)
  File "N:\A Level\python 3.6.6\lib\urllib3\connectionpool.py", line 815, in _prepare_proxy
    conn.connect()
  File "N:\A Level\python 3.6.6\lib\urllib3\connection.py", line 314, in connect
    conn = self._new_conn()
  File "N:\A Level\python 3.6.6\lib\urllib3\connection.py", line 180, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x000001F19EC9CC88>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "N:\A Level\python 3.6.6\lib\requests\adapters.py", line 445, in send
    timeout=timeout
  File "N:\A Level\python 3.6.6\lib\urllib3\connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "N:\A Level\python 3.6.6\lib\urllib3\util\retry.py", line 398, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.googleapis.com', port=443): Max retries exceeded with url: /books/v1/volumes?q=0003225151 (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x000001F19EC9CC88>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed',)))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "N:\A Level\python 3.6.6\lib\tkinter\__init__.py", line 1702, in __call__
    return self.func(*args)
  File "D:\Project-Bookworm\entry.py", line 59, in <lambda>
    self.root.bind('<Return>', (lambda event: self.quit()))
  File "D:\Project-Bookworm\entry.py", line 74, in quit
    j, k, l, m, n, o, p, q, r = books.getAll(books.getBook(isbn))
  File "D:\Project-Bookworm\books_api.py", line 13, in getBook
    deets = api.list(isbn1)
  File "D:\Project-Bookworm\googlebooks.py", line 121, in list
    return self._get(path, params)
  File "D:\Project-Bookworm\googlebooks.py", line 29, in _get
    resp = requests.get(self.__BASEURL + path, params=params)# , proxies=urllib.request.getproxies(), headers=self.headers)
  File "N:\A Level\python 3.6.6\lib\requests\api.py", line 72, in get
    return request('get', url, params=params, **kwargs)
  File "N:\A Level\python 3.6.6\lib\requests\api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "N:\A Level\python 3.6.6\lib\requests\sessions.py", line 513, in request
    resp = self.send(prep, **send_kwargs)
  File "N:\A Level\python 3.6.6\lib\requests\sessions.py", line 623, in send
    r = adapter.send(request, **kwargs)
  File "N:\A Level\python 3.6.6\lib\requests\adapters.py", line 507, in send
    raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='www.googleapis.com', port=443): Max retries exceeded with url: /books/v1/volumes?q=0003225151 (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x000001F19EC9CC88>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed',)))

 

 

SPECS:

AMD Ryzen 1800x @4Ghz

32GB DDR4 G.Skill Trident-Z RGB 3200Mhz

ASUS ROG STRIX B350-F Gaming motherboard

RX 5700 XT

750W Corsair PSU

Fractal Design Meshify C

250gb WD Black NVMe SSD

 

Peripherals:

Asus VG24V 144hz 1080p

Logitech MX Master

Corsair K70 Mk2

Stream Deck

GoXLR Mini

Logitech Z330, Corsair Virtuoso

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×