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

with_path? #9

Closed
hynek opened this issue Sep 7, 2016 · 3 comments
Closed

with_path? #9

hynek opened this issue Sep 7, 2016 · 3 comments

Comments

@hynek
Copy link
Contributor

hynek commented Sep 7, 2016

There doesn’t seem to be a way to completely replace the path with a different one? Or at least to discard the path?

Same goes for fragments when I think of it. Are those design decisions or just lack of time?

@asvetlov
Copy link
Member

asvetlov commented Sep 7, 2016

I had with_path in very early versions.
But it's controversial: most likely path changing should clean up query and fragment parts.
url / 'path', url.with_name('name') and url.parent clears them but all other with_*() methods don't.

Also yarl has .origin() method (sorry, I've missed it in documentation):

>>> URL('http://example.com/path/to?a=b#frag').origin()
URL('http://example.com')

Path replacement can be done as url.origin() / new_path.
I can add with_path easy but do you really need it?

About fragments -- I don't follow. Aaah. Again documentation lack.
There are with_frament() and with_query() methods, sure!

Will publish doc update today.

@hynek
Copy link
Contributor Author

hynek commented Sep 7, 2016

yes, .origin is just fine.

@asvetlov
Copy link
Member

asvetlov commented Sep 7, 2016

I've updated the doc.

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

No branches or pull requests

2 participants