-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for preparing requests with base URL
We now override the `prepare_request` method of the Session to generate a complete URL from the session's base URL and a partial resource name. The request is then prepared with the complete URL. >>> from requests import Request >>> from requests_toolbelt import sessions >>> s = sessions.BaseUrlSession( ... base_url='https://example.com/resource/') >>> request = Request(method='GET', url='sub-resource/') >>> prepared_request = s.prepare_request(request) >>> r = s.send(prepared_request) >>> print(r.request.url) https://example.com/resource/sub-resource Closes #315.
- Loading branch information
mbBRCM
committed
Oct 26, 2021
1 parent
5ead53f
commit d2810a2
Showing
2 changed files
with
53 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters