Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add a
base_url
option toClientSession
#6129Add a
base_url
option toClientSession
#6129Changes from all commits
e32aae7
6594496
2284103
8908e5c
8e12793
cdd1d36
27abd80
0215ef2
ac70734
fc43fa9
fc2c8b6
03fca2b
adb988d
2691562
6b98871
8868d36
7e7b271
1d4fd67
e8a9915
3a85902
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is correct, sure.
I think an example (or
.. note::
) that demonstrates the result of joining base URL with partial path and a relative path can be helpful also.httpbin.org supports
/status/{codes}
and/image/jpeg
//image/png
urls.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is an example that uses
base_url
feature of the code above.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like a doctest could be more visual here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this is the problem.
If I call
URL.join
forhttp://httpbin.org/status
and200
I gethttp://httpbin.org/200
which is probably not expected result :-)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooh.
Tests for the standard
urllib.parse.urljoin()
:Sorry, I should go now.
Tomorrow I'll check the compliance of behavior above with RFC. I suspect it matches :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, works as expected by RFC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked one more time:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asvetlov
It works as expected by RFC, but I think the feature wasn't about RFC implementation.
May be it would be better if
base_url='http://httpbin.org/status'
andurl='/200'
buildhttp://httpbin.org/status'/200
.Not RFC complaint, but I would expect such behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option is following the current
url / path
behavior:base_url='http://httpbin.org/status'
andurl='/200'
is forbiddenbase_url='http://httpbin.org/status'
andurl='200'
buildshttp://httpbin.org/status/200
BTW, should we forbid query/fragment parts in
base_url
? They are ignored anyway.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's wait for the user feedback on it.