Stadly / TimelineExtractor

Extract location history from Google Maps Timeline
MIT License
36 stars 1 forks source link

Extract fails: UnicodeEncodeError: 'latin-1' codec can't encode character #4

Open hashworks opened 1 month ago

hashworks commented 1 month ago
INFO: Calculating location history for 2000-01-01 to 2024-10-16
Traceback (most recent call last):
  File "/TimelineExtractor/src/extract.py", line 97, in <module>
    main()
    ~~~~^^
  File "/TimelineExtractor/src/extract.py", line 87, in main
    History = GetLocationHistoryForDateRange(Args.start, Args.end, AuthCookie, Args.authuser, Args.rapt)
  File "/TimelineExtractor/src/extract.py", line 30, in GetLocationHistoryForDateRange
    return LocationHistory.GetDateRange(StartDate, EndDate, AuthCookie, AuthUser, Rapt)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/TimelineExtractor/src/LocationHistory.py", line 110, in GetDateRange
    LocationHistory = GetDate(StartDate, AuthCookie, AuthUser, Rapt)
  File "/TimelineExtractor/src/LocationHistory.py", line 64, in GetDate
    Response = requests.get(Url, cookies=dict(cookie=AuthCookie))
  File "/usr/local/lib/python3.13/site-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
  File "/usr/local/lib/python3.13/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.13/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.13/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
        method=request.method,
    ...<9 lines>...
        chunked=chunked,
    )
  File "/usr/local/lib/python3.13/site-packages/urllib3/connectionpool.py", line 789, in urlopen
    response = self._make_request(
        conn,
    ...<10 lines>...
        **response_kw,
    )
  File "/usr/local/lib/python3.13/site-packages/urllib3/connectionpool.py", line 495, in _make_request
    conn.request(
    ~~~~~~~~~~~~^
        method,
        ^^^^^^^
    ...<6 lines>...
        enforce_content_length=enforce_content_length,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/urllib3/connection.py", line 440, in request
    self.putheader(header, value)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/urllib3/connection.py", line 354, in putheader
    super().putheader(header, *values)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/http/client.py", line 1309, in putheader
    values[i] = one_value.encode('latin-1')
                ~~~~~~~~~~~~~~~~^^^^^^^^^^^
UnicodeEncodeError: 'latin-1' codec can't encode character '\u2026' in position 519: ordinal not in range(256)
Stadly commented 3 weeks ago

Very strange. Do you encounter the issue both when running the python script directly and through Docker?

hashworks commented 3 weeks ago

Yes.