Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnboundLocalError: cannot access local variable 'req' where it is not associated with a value #82

Open
XodiaXz opened this issue Apr 16, 2024 · 0 comments

Comments

@XodiaXz
Copy link

XodiaXz commented Apr 16, 2024

Hi, I get the following error:

Traceback (most recent call last):
  File "C:\Users\JOSE\Downloads\Compressed\GoBooDo-master\GoBooDo-master\GoBooDo.py", line 50, in resethead
    req = requests.get("https://google."+self.country, cookies={'CONSENT': 'YES+1'}, verify=False)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\JOSE\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\JOSE\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\JOSE\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\JOSE\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\JOSE\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "C:\Users\JOSE\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connectionpool.py", line 793, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\JOSE\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connectionpool.py", line 467, in _make_request
    self._validate_conn(conn)
  File "C:\Users\JOSE\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connectionpool.py", line 1099, in _validate_conn
    conn.connect()
  File "C:\Users\JOSE\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connection.py", line 616, in connect
    self.sock = sock = self._new_conn()
                       ^^^^^^^^^^^^^^^^
  File "C:\Users\JOSE\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\connection.py", line 198, in _new_conn
    sock = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\JOSE\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\util\connection.py", line 58, in create_connection
    raise LocationParseError(f"'{host}', label empty or too long") from None
urllib3.exceptions.LocationParseError: Failed to parse: 'google..mx', label empty or too long

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\JOSE\Downloads\Compressed\GoBooDo-master\GoBooDo-master\GoBooDo.py", line 216, in <module>
    book = GoBooDo(args.id)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\JOSE\Downloads\Compressed\GoBooDo-master\GoBooDo-master\GoBooDo.py", line 32, in __init__
    self.resethead()
  File "C:\Users\JOSE\Downloads\Compressed\GoBooDo-master\GoBooDo-master\GoBooDo.py", line 61, in resethead
    if 'captcha'.encode() in req.content:
                             ^^^
UnboundLocalError: cannot access local variable 'req' where it is not associated with a value

How can I Fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant