Comments (3)
You absolutely can, reference, using entry_points
plugin discovery. Edited to add: though a PR to add such to the core library would be appreciated for HTTP-like ("URL") URI in common usage, especially if reference to the specification defining it can be provided. (Docstrings are great, and on GitHub creating a fork and issuing a PR from viewing a file you want changed is essentially three clicks and some typing.) Apologies for all the edits, apparently I'm retentive.
from uri.
Thank, I learned more about Python. I found the schemas in the setup.py but didn't know how to edit during runtime.
from uri.
… but didn't know how to edit during runtime.
Ah! That's generally not the best way to do this, as it can represent an "import time side-effect" (ref: common mistakes; same content from a possibly non-Medium-powered, but rather ugly site).
However, AL/№ 36: practicality beats purity. It's possible, but requires modifying an object within the URI package dynamically at runtime. This is the code that would provide the desired change:
from uri.scheme import URLScheme
from uri.part.scheme import SchemePart
SchemePart.registry['amqp'] = URLScheme('amqp')
SchemePart.registry['amqps'] = URLScheme('amqps')
The seeming duplication is due to the fact the generic URLScheme
formatter needs to know what it is representing, and the registry itself needs to be able to look up this formatter by string name. Using entry_points
plugins this is automated away. (The registry
here is a cache or short-circuit, saving the need for repeated iterative querying of Python package metadata to go looking for plugins and instantiation of such on every use. Essentially a pool of singletons.)
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
- 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.