micaeljarniac / buildurl Goto Github PK
View Code? Open in Web Editor NEWSimple URL builder
Home Page: https://buildurl.readthedocs.io
License: MIT License
Simple URL builder
Home Page: https://buildurl.readthedocs.io
License: MIT License
E.g. url = BuildURL('example.com', trailing_slash=True)
so one can set it from the beginning:)
Hello, http://www.example.com/path
can be different from http://www.example.com/path/
or even might not exists at all. So it would be good to have an option to keep trailing slash.
It would be nice if methods add_path()
and add_query()
return self
so one can easily chain calls like u.add_path('foo').add_path('bar')
Also fluent setter for trailing_slash
would be helpful. E.g.:
def set_trailing_slash(self, enabled = True):
self.trailing_slash = bool(enabled)
return self
from buildurl import BuildURL
url = BuildURL("example.com")
url.get # example.com
url.scheme = "https"
url.get # https:///example.com
url.parts # ('https', '', 'example.com', '', '')
It would be convenient to be able to call methods like this:
url.add_path('foo', 'bar', 'xyz')
url.add_query(foo=1, bar=2)
I've only discovered furl after creating BuildURL.
They have a lot in common, so it's worth referencing furl as a possible alternative.
Bug part: I was trying to do something like .add_path(['user', 123])
and it didn't raise an exception during the execution of the method but only when i called .get
, which is imho late.
Feature request: Everything should be converted to str automatically (not raising error) or at least usual types like int, float. I think it should be user's responsibility to provide desired str output and everyone knows that resulting url is always str.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.