zulip / python-zulip-api

Python library for the Zulip API.
https://zulip.com/api/
Apache License 2.0
353 stars 355 forks source link

zulip: Add hash_util_decode() to decode server encoded URL excerpts #614

Closed preetmishra closed 4 years ago

preetmishra commented 4 years ago

This adds hash_util_decode() to decode a hash_util_encode() [present in zulip/zulip's zerver/lib/url_encoding.py] encoded string.

The intent is to facilitate code sharing among various python clients (primarily, Zulip Terminal).

The string replacement before the unquote is to recoup for the custom string replacements in zulip/zulip's zerver/lib/url_encoding.py.

Conversation link: https://chat.zulip.org/#narrow/stream/127-integrations/topic/Decode.20server.20URLs/near/977374

preetmishra commented 4 years ago

@timabbott Thanks for the comment. I have updated the PR with tests.

timabbott commented 4 years ago

Merged, thanks @preetmishra! I think ultimately we're going to want some higher-level functions on top of this that take a URL and decode it, with a documented interface, but happy to merge this as progress.