Skip to content
New issue

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

Allow redirects for requests #32

Closed
gar1t opened this issue Jun 9, 2020 · 3 comments · Fixed by #34
Closed

Allow redirects for requests #32

gar1t opened this issue Jun 9, 2020 · 3 comments · Fixed by #34

Comments

@gar1t
Copy link

gar1t commented Jun 9, 2020

Are you aware of any issues when supporting redirects from the Discourse server? In your call to requests.request() you explicitly set allow_redirects to False. This prevents topic lookup by path only (omitting the ID).

I think a number of functions could make ID optional using the server redirect to resolve as needed.

@bennylope
Copy link
Collaborator

Are you aware of any issues when supporting redirects from the Discourse server?

I'm not aware of any, it was added here 0cef55a probably because it seemed sensible?

Don't see any reasons why this couldn't be changed.

@gar1t
Copy link
Author

gar1t commented Jun 9, 2020

I'm working on a fork atm and will try to apply this redirect support where I can spot opportunities. E.g. client.topic(slug) where id can be omitted seems to work. When I have something presentable I'll open a PR for review.

@abkfenris
Copy link

I've created a PR that takes a swing at allowing redirects for certain methods #34 .

I found this issue with client.category_topics(id) as /c/{id}.json now redirects to /c/{category_slug}.json.

My PR implements this by allowing request_kwargs to be passed to the HTTP verb methods, which pass it along to client._request where they can override the default keyword arguments for request.request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants