Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
6 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,10 @@ | |
|
||
from io import BytesIO | ||
|
||
from six import PY3 | ||
from six import ensure_binary | ||
from six.moves.collections_abc import Mapping | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
twm
Contributor
|
||
from six.moves.http_cookiejar import CookieJar | ||
from six.moves.urllib import urlencode as _urlencode | ||
|
||
from twisted.internet.interfaces import IProtocol | ||
from twisted.internet.defer import Deferred | ||
|
@@ -35,25 +38,8 @@ | |
from treq.response import _Response | ||
from requests.cookies import cookiejar_from_dict, merge_cookies | ||
|
||
if PY3: | ||
from urllib.parse import urlencode as _urlencode | ||
|
||
def urlencode(query, doseq): | ||
return _urlencode(query, doseq).encode('ascii') | ||
from http.cookiejar import CookieJar | ||
else: | ||
from cookielib import CookieJar | ||
from urllib import urlencode | ||
|
||
try: | ||
# The old location was quixotically deprecated and might actually be | ||
# removed in 3.10, maybe. | ||
# | ||
# See https://github.com/html5lib/html5lib-python/issues/419 for more of | ||
# this tale of woe. | ||
from collections.abc import Mapping | ||
except ImportError: | ||
from collections import Mapping | ||
def urlencode(query, doseq): | ||
return six.ensure_binary(_urlencode(query, doseq)) | ||
|
||
|
||
class _BodyBufferingProtocol(proxyForInterface(IProtocol)): | ||
|
This requires
six>=1.13.0
. Please declare that in the dependencies or import form the standard library locations. Thanks!Examples of breakage caused by this:
ludwig-ai/ludwig#632
raiden-network/raiden: https://app.circleci.com/pipelines/github/raiden-network/scenario-player/1589/workflows/e6dc2603-76fa-4905-8452-62ba6922dbfd/jobs/4095