api: Add bindings for fetching user avatar.#919
Conversation
2bb6e7c to
14f68ee
Compare
ab9c2ad to
b68598e
Compare
| if v is not None: | ||
| marshalled_request[k] = v | ||
| versioned_url = API_VERSTRING + (url if url is not None else "") | ||
| url = url or "" |
There was a problem hiding this comment.
Is there a case where we should allow this to be empty string?
This adds methods for fetching user avatars to the Client class. There is some plumbing in call_endpoint to make sure it can call endpoints that don't include the API version string (/api/v1), such as the avatar endpoints.
b68598e to
18bb73b
Compare
|
@prakhar1144 -- Could you please review this one? |
|
How is authentication normally handled in the bindings? We should take care not to follow off-realm redirects with auth headers included. I'm not sure whether this revision handles that correctly or not. |
The
The I've included an |
Prep PR for: zulip/zulip#32495
Reasonings for a couple decisions I made when working on this:
get_user_by_idfor the/user/{user_id}, so I opted to name the methods something likeget_avatar_url_by_id.get_avatar_url_by_idandget_avatar_url_by_emailinstead of a method that accepts a parameter likeuser_id_or_email: str | intsince we've deliberately split theavatar/endpoint in the server.CZO: #api documentation > Python examples that require importing other modules. @ 💬
Self-review checklist
(variable names, code reuse, readability, etc.).
Communicate decisions, questions, and potential concerns.
Individual commits are ready for review (see commit discipline).
Completed manual review and testing of the following: