Clarify how to encode parameters in the Python bindings
See original GitHub issueWe got a report form a user that they had trouble with https://zulip.com/api/get-subscriptions, because they tried:
client.get_subscriptions(include_subscribers=True)
and got an exception. The actual way to pass that parameter is:
client.get_subscriptions(dict(include_subscribers=True))
i.e. pass the parameters as a dictionary, rather than as arguments to this function. I think the user was very reasonable in being confused by this, since we don’t say clearly anywhere on that page how to encode that detail in the Python bindings.
We should figure out how to either document this or adjust API endpoints like this one to pass their kwards are parameters.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
How can I percent-encode URL parameters in Python?
@chrizonline Just use urllib.parse.quote(url, safe=':/') . Even better, encode some path , then join strings. This is ...
Read more >Python Strings encode() method - GeeksforGeeks
Parameters : encoding: Specifies the encoding on the basis of which encoding has to be performed. errors: Decides how to handle the errors...
Read more >codecs — Codec registry and base classes — Python 3.11.1 ...
This module defines base classes for standard Python codecs (encoders and decoders) and provides access to the internal Python codec registry, which manages...
Read more >Comma encoding in request params · Issue #794 - GitHub
I'm making requests against an API which takes comma separated parameter values. A working request looks like this: curl http://localhost:4444/endpoint?val= ...
Read more >Percent-encoding - Wikipedia
Percent-encoding, also known as URL encoding, is a method to encode arbitrary data in a Uniform Resource Identifier (URI) using only the limited...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Use the same rule the
dictfunction itself uses, which is that the kwargs take precedence:And we can just deprecate the non-kwargs way, since it can be replaced with
client.list_subscriptions(**some_dict).As long as there’s no conflict between the specific request parameters and the general options, this seems reasonable to allow, though we’d have to resolve (or document) the case of which takes precedence if specifying parameters both ways.