Requests: Session baseUrl?

Created on 4 Jul 2018  ·  4Comments  ·  Source: psf/requests

"Requests is not accepting feature requests at this time." I see.

But really guys, would it be too much to ask to get this implemented into the Sessions? I could submit a PR. Axios and many other libraries support this already, and it comes it really handy.

I know there are workarounds, subclass it and what not but that is so ugly when it could be built into the module with ~5 lines of code.

Please 💯
Thanks

All 4 comments

In the future, please search closed and open issues before creating new ones that are duplicates.

I am aware there have been previous requests, but obviously, they haven't been answered... Hence me opening a new issue.

There wasn't even a discussion, that thread was killed instantly, kind of like this one.

I get that hooks can be used, but It seems like baseUrl would be much cleaner and much more readable.

Actually, after further testing it, hooks cannot be used like in the above issue. From what I have seen, you now can only hook the response, but not the args.

http://docs.python-requests.org/en/master/user/advanced/#event-hooks

Hi @NoahCardoza, I believe what @sigmavirus24 is pointing out is that we've already done the work for this and it's freely available in the Requests toolbelt as detailed in those other issues.

We cannot feasibly support every possible knob and whistle people want in Requests, so we provided the ability to either implement them yourself, or use our implementations of them in the toolbelt. We have dozens of messages discussing this topic, so I'm not sure what you feel is unanswered here.

Further, there's more than just one issue discussing this. Others have had full discussions. You're not so special as to receive that precious time of mine or Nate's to have another full discussion.

Was this page helpful?
0 / 5 - 0 ratings