We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The new params merging code in 20.3.0 regressed: it now forbids the characters & and # in param values.
&
#
This is because we're using hyperlink.URL (a.k.a. hyperlink.EncodedURL) when we want hyperlink.DecodedURL.
hyperlink.URL
hyperlink.EncodedURL
hyperlink.DecodedURL
For example:
from twisted.internet.task import react from twisted.internet.defer import inlineCallbacks import treq @inlineCallbacks def main(reactor): print('Preserved query parameters') resp = yield treq.get('https://httpbin.org/get?foo=bar', params={'baz': 'b&x'}) content = yield resp.text() print(content) react(main, [])
Produces an exception:
Traceback (most recent call last): File "docs/examples/query_params.py", line 15, in <module> react(main, []) ... File "docs/examples/query_params.py", line 11, in main params={'baz': 'b&x'}) File "/home/twm/treq/src/treq/api.py", line 24, in get return _client(**kwargs).get(url, headers=headers, **kwargs) File "/home/twm/treq/src/treq/client.py", line 119, in get return self.request('GET', url, **kwargs) File "/home/twm/treq/src/treq/client.py", line 172, in request query=parsed_url.query + tuple(_coerced_query_params(params)) File "/home/twm/treq/.tox/py37-twisted_latest/lib/python3.7/site-packages/hyperlink/_url.py", line 1085, in replace uses_netloc=_optional(uses_netloc, self.uses_netloc) File "/home/twm/treq/.tox/py37-twisted_latest/lib/python3.7/site-packages/hyperlink/_url.py", line 838, in __init__ for k, v in iter_pairs(query)) File "/home/twm/treq/.tox/py37-twisted_latest/lib/python3.7/site-packages/hyperlink/_url.py", line 838, in <genexpr> for k, v in iter_pairs(query)) File "/home/twm/treq/.tox/py37-twisted_latest/lib/python3.7/site-packages/hyperlink/_url.py", line 475, in _textcheck % (''.join(delims), name, value)) builtins.ValueError: one or more reserved delimiters &# present in query parameter value: 'b&x'
I filed python-hyper/hyperlink#125 about getting the latter documented.
The text was updated successfully, but these errors were encountered:
twm
Successfully merging a pull request may close this issue.
The new params merging code in 20.3.0 regressed: it now forbids the characters
&
and#
in param values.This is because we're using
hyperlink.URL
(a.k.a.hyperlink.EncodedURL
) when we wanthyperlink.DecodedURL
.For example:
Produces an exception:
I filed python-hyper/hyperlink#125 about getting the latter documented.
The text was updated successfully, but these errors were encountered: