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

Implement Path-like division operators. #3

Closed
amcgregor opened this issue Jun 6, 2017 · 0 comments
Closed

Implement Path-like division operators. #3

amcgregor opened this issue Jun 6, 2017 · 0 comments
Assignees
Milestone

Comments

@amcgregor
Copy link
Member

Examples:

from uri import URI

base = URI("http://example.com/foo/bar.html")

base / "baz.html"  # http://example.com/foo/baz.html
base // "cdn.example.com" / "baz.html"  # http://cdn.example.com/baz.html
base / "/diz"  # http://example.com/diz
base / "#diz"  # http://example.com/foo/bar.html#diz
base / "https://example.com"  # https://example.com

A concrete example:

base = URI("http://ats.example.com/job/listing")

# scrape the listing, identify a job URL from that listing
target = URI("detail/sample-job")  # oh no, it's relative!

job = base / target  # And it's resolved.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant