Comments (2)
Curious! Indeed, the .resolve()
method isn't applying those fragments properly.
>>> a = uri.URI("ldap://[2001:db8::7]/c=GB?objectClass?one"); a
URI('ldap://[2001:db8::7]/c=GB?objectClass?one')
>>> a / "/c=NO"
URI('ldap://[2001:db8::7]/c=NO')
While the "resolve" method does not correctly handle this case, the division operator does. It ought to correctly resolve this, however. Thanks for reporting! The second case isn't quite as simple.
>>> a = URI('sftp:example.com/etc/passwd'); a
URI('sftp:example.com/etc/passwd') # looks right, but this is an illusion
>>> a.authority # no host component
''
In this particular case, :
is insufficient. The sftp
scheme defines the following syntax:
sftp://[<user>[;fingerprint=<host-key fingerprint>]@]<host>[:<port>]/<path>/<file>
While adding the //
does allow it to parse correctly, the REPR is not an identity transform. (This is also an issue.)
>>> a = URI('sftp://example.com/etc/passwd'); a
URI('sftp:example.com/etc/passwd')
>>> a.authority
'example.com'
I'll need to add sftp
as a recognized URL-like protocol via https://github.com/marrow/uri/blob/develop/setup.py#L98
The last case is explained by non-URL URI treating everything after the authority part as path. For most URI schemes (e.g. URN, ISBN, etc., etc.) the part after the protocol is protocol-defined and arbitrary.
from uri.
Adding the registration of sftp = uri.scheme:URLScheme
to setup.py
and issuing a setup.py develop
call to link it, SFTP URI now behave correctly:
>>> a = uri.URI("sftp://example.com/etc/passwd"); a
URI('sftp://example.com/etc/passwd')
>>> a.resolve("/root")
URI('sftp://example.com/root')
>>> uri.URI("sftp:example.com/etc/passwd")
URI('sftp://example.com/etc/passwd')
This'll be bundled in the next release, this week. Available in commit a8718ac. (If you are impatient, you can link this entry_point
in your own application; just remember to remove your own registration of it after you update your URI version.)
from uri.
Related Issues (20)
- Use slice notation on URI's for authentication creds HOT 3
- Rootless file URI does not round trip HOT 10
- Add method to reconstruct the request URI from a WSGI environment. HOT 2
- Missing scheme HOT 3
- Utilize "services" index for default port identification.
- Implement "URL fopen"-like behavior.
- Support and utilise native IP address representations. HOT 3
- Automatically handle punycode encoding and decoding. HOT 2
- Deprecation Warning for import of namedtuple from collections instead of collections.abc HOT 7
- disappearing "//" HOT 10
- Implement Python __hash__ method to permit use as dictionary keys and set members. HOT 7
- URI with empty path HOT 9
- URI variant that pulls in page titles during HTML expansion.
- ImportError: cannot import name 'ItemsView' from 'collections' HOT 1
- Correct Pretty-RFC links. HOT 1
- Add "yarl" to the "Migrating"-section in the README
- Please release 3.0.0 HOT 3
- Make "empty path element" handling more explicit.
- Host/host:port and path aren't definitively separated by a slash HOT 7
- For some schemes, URLs with no authority are rendered incorrectly HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uri.