Skip to content

not able to use proxy #29

@PythonEatsSQuirreL

Description

@PythonEatsSQuirreL

I am trying to use some known-working proxies with this project, unfortunately with any proxy, the result is the same:

File "c:\Users\PsychO\Downloads\yars-main\yars-main\src\yars\yars.py", line 245, in fetch_subreddit_posts
response = self.session.get(url, params=params, timeout=self.timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\PsychO\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\sessions.py", line 602, in get
return self.request("GET", url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\PsychO\Downloads\yars-main\yars-main\src\yars\sessions.py", line 15, in request
return super().request(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\PsychO\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\PsychO\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\PsychO\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\adapters.py", line 633, in send
conn = self.get_connection_with_tls_context(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\PsychO\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\adapters.py", line 476, in get_connection_with_tls_context
proxy = prepend_scheme_if_needed(proxy, "http")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\PsychO\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\utils.py", line 995, in prepend_scheme_if_needed
parsed = parse_url(url)
^^^^^^^^^^^^^^
File "c:\Users\PsychO\AppData\Local\Programs\Python\Python312\Lib\site-packages\urllib3\util\url.py", line 402, in parse_url
if not _SCHEME_RE.search(url):
^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'bool'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\Users\PsychO\Downloads\yars-main\yars-main\example\example3.py", line 17, in
subreddit_posts = miner.fetch_subreddit_posts("generative", limit=10, category="top", time_filter="all")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\PsychO\Downloads\yars-main\yars-main\src\yars\yars.py", line 250, in fetch_subreddit_posts
if response.status_code != 200:
^^^^^^^^
UnboundLocalError: cannot access local variable 'response' where it is not associated with a value

Strange that locally (with my ip) it works flawless, but I want to avoid the ban so I started to build a proxy rotation method but with each proxy I'm getting the above error.

Some used in testing: "34.227.103.172:20202", "51.17.115.67:20202".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions