You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add function for downloading an uploaded file #628
Zulip's API has a pair of related URLs for accessing uploaded files that need better documentation and tooling:
GET /user_uploads/...
GET /api/v1/user_uploads/...
The former just downloads a file (possibly via a 302 redirect to a temporary access URL of the form /user_uploads/temporary/...). The latter returns such a temporary access URL (basically what the former would have redirected to), which is useful for cases where a client's HTTP library doesn't support following redirects. Neither is currently covered in our API documentation.
The consequence of this is background is that client.call_endpoint() in the Python bindings using logic like this:
which is the most convenient way to provide authentication, may end up visiting /api/v1/user_uploads and returning a temporary access URL, rather than downloading the file. What we need is an alternative to client.call_endpoint that doesn't prepend /api/v1/. One option would be to refactor the call_endpoint system to require passing /api/v1 explicitly, which might be a better system in any case; then something like the code above would work. (I'd want to provide an explicit client.fetch_upload(path | url) method in any case, but it could just call client.call_endpoint, and we'd have a clear mechanism for how to use API authentication to request other similar endpoints that don't have an /api/v1 prefix in the future -- which will largely be endpoints that serve images or other assets that need to be shared between web and mobile)
Welcome to Zulip, @ayushi19031! We just sent you an invite to collaborate on this repository at https://github.com/zulip/python-zulip-api/invitations. Please accept this invite in order to claim this issue and begin a fun, rewarding experience contributing to Zulip!
Here's some tips to get you off to a good start:
Join me on the Zulip developers' server, to get help, chat about this issue, and meet the other developers.
As you work on this issue, you'll also want to refer to the Zulip code contribution guide, as well as the rest of the developer documentation on that site.
See you on the other side (that is, the pull request side)!
Welcome to Zulip, @sundargs2000! We just sent you an invite to collaborate on this repository at https://github.com/zulip/python-zulip-api/invitations. Please accept this invite in order to claim this issue and begin a fun, rewarding experience contributing to Zulip!
Here's some tips to get you off to a good start:
Join me on the Zulip developers' server, to get help, chat about this issue, and meet the other developers.
As you work on this issue, you'll also want to refer to the Zulip code contribution guide, as well as the rest of the developer documentation on that site.
See you on the other side (that is, the pull request side)!
@harshil0014 You can't claim this issue, as you're already working on 1 issue in this repository. Check out the contributing guide for advice on what to do while waiting for the next round of review.
Welcome to Zulip, @tathyavarma! By picking up a Zulip issue, you're promising to do your best to follow Zulip's contributing guidelines. Neglecting to do so wastes maintainer time, and may result in being banned from contributing to Zulip.
To get started:
Work through all the "Prior to picking up your first issue" sections of the Zulip contributor guide.
Post a comment here describing your plan for how to approach this issue. Before you claim an issue, you should be confident that you will be able to tackle it effectively.
The issue will be assigned to you when all three steps have been completed. If you get stuck, you can always @zulipbot abandon this issue, and pick a different one.
If someone else claims this issue while you're working through the checklist, no worries! You can contribute by providing feedback on their pull request. If you’ve made good progress in understanding part of the codebase, you can also find another “help wanted” issue in the same area to work on.
@tathyavarma You have been unassigned from this issue because you have not made any updates for over 14 days. Please feel free to reclaim the issue if you decide to pick up again. Thanks!
Hi! I'd like to work on this. I read the server code (zproject/urls.py, zerver/views/upload.py) to pin down the behavior:
GET /api/v1/user_uploads/... returns a JSON temporary-access URL (serve_file_url_backend) - what call_endpoint() returns today, which is the bug in the issue.
The unprefixed GET /user_uploads/... path serves the file and supports API auth; the upload response's url is root-relative, so a download helper must resolve it against the server root and cannot reuse call_endpoint().
Plan (non-breaking, no call_endpoint refactor): add Client.fetch_upload(url_or_path, timeout=None) that accepts an absolute URL or a server-root-relative /user_uploads/... path, GETs with the client session (redirects allowed), returns the raw bytes, and raises ZulipError on non-200. Unit tests with a mocked HTTP layer; happy to keep the call_endpoint prefix refactor out of this PR and discuss separately.
Welcome to Zulip, @harshvardhan178251! By picking up a Zulip issue, you're promising to do your best to follow Zulip's contributing guidelines. Neglecting to do so wastes maintainer time, and may result in being banned from contributing to Zulip.
To get started:
Work through all the "Prior to picking up your first issue" sections of the Zulip contributor guide.
Post a comment here describing your plan for how to approach this issue. Before you claim an issue, you should be confident that you will be able to tackle it effectively.
The issue will be assigned to you when all three steps have been completed. If you get stuck, you can always @zulipbot abandon this issue, and pick a different one.
If someone else claims this issue while you're working through the checklist, no worries! You can contribute by providing feedback on their pull request. If you’ve made good progress in understanding part of the codebase, you can also find another “help wanted” issue in the same area to work on.
Hi — a quick status check on this issue from my side. My PR #948 adds Client.fetch_upload() (returns raw file bytes; absolute off-server URLs rejected so bot credentials are not sent elsewhere). All checks pass except two upstream-dead CI jobs (the bullseye Zulip 4.0 job, and Python 3.9 on the current ubuntu-latest runner), both of which are fixed in #949. I'm happy to address any feedback on the PR.
Activity
reference to zulip/python-zulip-api#628
ayushi19031 commentedon Oct 10, 2020
@zulipbot claim
zulipbot commentedon Oct 10, 2020
Welcome to Zulip, @ayushi19031! We just sent you an invite to collaborate on this repository at https://github.com/zulip/python-zulip-api/invitations. Please accept this invite in order to claim this issue and begin a fun, rewarding experience contributing to Zulip!
Here's some tips to get you off to a good start:
As you work on this issue, you'll also want to refer to the Zulip code contribution guide, as well as the rest of the developer documentation on that site.
See you on the other side (that is, the pull request side)!
zulipbot commentedon Oct 20, 2020
Hello @ayushi19031, you have been unassigned from this issue because you have not updated this issue or any referenced pull requests for over 14 days.
You can reclaim this issue or claim any other issue by commenting
@zulipbot claimon that issue.Thanks for your contributions, and hope to see you again soon!
tushar912 commentedon Jan 10, 2021
@zulipbot claim
sundargs2000 commentedon Feb 19, 2021
@zulipbot claim
zulipbot commentedon Feb 19, 2021
Welcome to Zulip, @sundargs2000! We just sent you an invite to collaborate on this repository at https://github.com/zulip/python-zulip-api/invitations. Please accept this invite in order to claim this issue and begin a fun, rewarding experience contributing to Zulip!
Here's some tips to get you off to a good start:
As you work on this issue, you'll also want to refer to the Zulip code contribution guide, as well as the rest of the developer documentation on that site.
See you on the other side (that is, the pull request side)!
46 remaining items
zulipbot commentedon Oct 18, 2026
@harshil0014 You can't claim this issue, as you're already working on 1 issue in this repository. Check out the contributing guide for advice on what to do while waiting for the next round of review.
zulip: Add Client.fetch_upload() to download uploaded files.
tathyavarma commentedon Oct 25, 2026
@zulipbot claim
zulipbot commentedon Oct 25, 2026
Welcome to Zulip, @tathyavarma! By picking up a Zulip issue, you're promising to do your best to follow Zulip's contributing guidelines. Neglecting to do so wastes maintainer time, and may result in being banned from contributing to Zulip.
To get started:
The issue will be assigned to you when all three steps have been completed. If you get stuck, you can always
@zulipbot abandonthis issue, and pick a different one.If someone else claims this issue while you're working through the checklist, no worries! You can contribute by providing feedback on their pull request. If you’ve made good progress in understanding part of the codebase, you can also find another “help wanted” issue in the same area to work on.
zulipbot commentedon Nov 4, 2026
@tathyavarma You have been unassigned from this issue because you have not made any updates for over 14 days. Please feel free to reclaim the issue if you decide to pick up again. Thanks!
zulip: Add Client.fetch_upload() to download uploaded files
harshvardhan178251 commentedon Nov 14, 2026
Hi! I'd like to work on this. I read the server code (zproject/urls.py, zerver/views/upload.py) to pin down the behavior:
Plan (non-breaking, no call_endpoint refactor): add Client.fetch_upload(url_or_path, timeout=None) that accepts an absolute URL or a server-root-relative /user_uploads/... path, GETs with the client session (redirects allowed), returns the raw bytes, and raises ZulipError on non-200. Unit tests with a mocked HTTP layer; happy to keep the call_endpoint prefix refactor out of this PR and discuss separately.
@zulipbot claim
zulipbot commentedon Nov 14, 2026
Welcome to Zulip, @harshvardhan178251! By picking up a Zulip issue, you're promising to do your best to follow Zulip's contributing guidelines. Neglecting to do so wastes maintainer time, and may result in being banned from contributing to Zulip.
To get started:
The issue will be assigned to you when all three steps have been completed. If you get stuck, you can always
@zulipbot abandonthis issue, and pick a different one.If someone else claims this issue while you're working through the checklist, no worries! You can contribute by providing feedback on their pull request. If you’ve made good progress in understanding part of the codebase, you can also find another “help wanted” issue in the same area to work on.
harshvardhan178251 commentedon Nov 14, 2026
Hi — a quick status check on this issue from my side. My PR #948 adds
Client.fetch_upload()(returns raw file bytes; absolute off-server URLs rejected so bot credentials are not sent elsewhere). All checks pass except two upstream-dead CI jobs (the bullseye Zulip 4.0 job, and Python 3.9 on the current ubuntu-latest runner), both of which are fixed in #949. I'm happy to address any feedback on the PR.