Skip to content

UnicodeEncodeError, cannot auth #21

Open
@EricWebsmith

Description

@EricWebsmith

UnicodeEncodeError

Thanks

❯ ./scrap https://leetcode.com/problems/convert-an-array-into-a-2d-array-with-conditions/description/\?envType\=daily-question\&envId\=2024-01-02
2024-01-02 08:53:10,842 Starting new HTTPS connection (1): leetcode.com:443
Traceback (most recent call last):
File "/home/eric/leetcode_py/scraping/scraper.py", line 32, in
scraper_result = ProblemScraper()(title_slug)
File "/home/eric/leetcode_py/scraping/scraper_problem.py", line 18, in init
self.api_instance = self.get_api_instance(leetcode_session, csrf_token)
File "/home/eric/leetcode_py/scraping/scraper_problem.py", line 21, in get_api_instance
csrf_token = leetcode.auth.get_csrf_cookie(leetcode_session)
File "/home/eric/.local/lib/python3.10/site-packages/leetcode/auth.py", line 5, in get_csrf_cookie
response = requests.get(
File "/home/eric/.local/lib/python3.10/site-packages/requests/api.py", line 73, in get
return request("get", url, params=params, **kwargs)
File "/home/eric/.local/lib/python3.10/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "/home/eric/.local/lib/python3.10/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "/home/eric/.local/lib/python3.10/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "/home/eric/.local/lib/python3.10/site-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
File "/home/eric/.local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 790, in urlopen
response = self._make_request(
File "/home/eric/.local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 496, in _make_request
conn.request(
File "/home/eric/.local/lib/python3.10/site-packages/urllib3/connection.py", line 394, in request
self.putheader(header, value)
File "/home/eric/.local/lib/python3.10/site-packages/urllib3/connection.py", line 308, in putheader
super().putheader(header, *values)
File "/usr/lib/python3.10/http/client.py", line 1256, in putheader
values[i] = one_value.encode('latin-1')
UnicodeEncodeError: 'latin-1' codec can't encode character '\u2026' in position 164: ordinal not in range(256)

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