censusgeocode icon indicating copy to clipboard operation
censusgeocode copied to clipboard

Fixed Urllib error (Issue #29)

Open MrMalfunction opened this issue 9 months ago • 1 comments

Library was giving urllib errors for python > 3.9 Error was (similar error in python 3.11.9)

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/requests_toolbelt/_compat.py", line 48, in <module>
    from requests.packages.urllib3.contrib import appengine as gaecontrib
ImportError: cannot import name 'appengine' from 'requests.packages.urllib3.contrib' (/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/urllib3/contrib/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/home/runner/work/censusgeocode-test/censusgeocode-test/tests/__init__.py", line 10, in <module>
    from . import test_censusgeocode
  File "/home/runner/work/censusgeocode-test/censusgeocode-test/tests/test_censusgeocode.py", line 14, in <module>
    from censusgeocode import CensusGeocode
  File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/censusgeocode/__init__.py", line 10, in <module>
    from .censusgeocode import CensusGeocode
  File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/censusgeocode/censusgeocode.py", line 26, in <module>
    from requests_toolbelt.multipart.encoder import MultipartEncoder
  File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/requests_toolbelt/__init__.py", line 12, in <module>
    from .adapters import SSLAdapter, SourceAddressAdapter
  File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/requests_toolbelt/adapters/__init__.py", line 12, in <module>
    from .ssl import SSLAdapter
  File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/requests_toolbelt/adapters/ssl.py", line 16, in <module>
    from .._compat import poolmanager
  File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/requests_toolbelt/_compat.py", line 50, in <module>
    from urllib3.contrib import appengine as gaecontrib
ImportError: cannot import name 'appengine' from 'urllib3.contrib' (/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/urllib3/contrib/__init__.py)

Allowed requests-toolbelt > 0.9.0 be allowed. requests-toolbelt 1.0.0 fixes the issue.

MrMalfunction avatar Apr 25 '24 18:04 MrMalfunction

Issue #29

MrMalfunction avatar Apr 25 '24 18:04 MrMalfunction

@MrMalfunction Thank you for the PR; this fixes an issue I am running into on python 3.11

rgegriff avatar May 13 '24 14:05 rgegriff

@fitnr Are you going to create a new release for pypi ? Just asking as we are currently cloning the repo for usage in our project.

MrMalfunction avatar May 13 '24 18:05 MrMalfunction

I will sometime in the next 48 hours.

fitnr avatar May 13 '24 18:05 fitnr