Skip to content
Myr

Remove path hacks that break chardet in Python 3. Closes #858.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This replaces the sys.path hack with a slightly less objectionable sys.modules hack. Both have the effect of making the vendored lib's absolue imports work as expected when oauthlib isn't installed. The sys.modules hack doesn't insert the rest of the vendored crap in a global path, however.

authored by Gabriel · committed by Gabriel · parent 4477d0a · Browse files · 1 file+2 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−3 removed

  • other:+2 added−3 removed

1 file+2 added−3 removed

modified:requests/_oauth.py+2 added-3 removed
14 unmodified lines
15 from oauthlib.oauth1 import rfc584916 from oauthlib.common import extract_params17 from oauthlib.oauth1.rfc5849 import (Client, SIGNATURE_HMAC, SIGNATURE_TYPE_AUTH_HEADER)18except ImportError:19 directory = os.path.dirname(__file__)20 path = os.path.join(directory, 'packages')21 sys.path.insert(0, path)19 from .packages import oauthlib20 sys.modules['oauthlib'] = oauthlib21 from oauthlib.oauth1 import rfc584922 from oauthlib.common import extract_params23 from oauthlib.oauth1.rfc5849 import (Client, SIGNATURE_HMAC, SIGNATURE_TYPE_AUTH_HEADER)