Skip to content

DolphDev/ezurl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Documentation Status

ezurl

Easy URL generation for Python

This Library is simply for dynamically generating URLs.

ezurl allows simple stuff like this

from ezurl import Url
#I want https://reddit.com/r/python
url = Url("reddit.com")
url.page("r", "python")
print(url) # https://reddit.com/r/python

while still allowing more complex urls like this

from ezurl import Url
#I want https://example.com/api/list/ExampleObject?name=Cool+Cat&createdby=Dolphin&ispublic=true
url = Url("example.com")
url.page("api", "list", "ExampleObject")
url.query(name=["Cool"+"Cat"], createdby="Dolphin", ispublic="true")
print(url) #Will be equivalent to https://example.com/api/list/ExampleObject?name=Cool+Cat&createdby=Dolphin&ispublic=true

It also supports one liners! (Using the example above)

from ezurl import Url
print(Url("example.com").page("api", "list", "ExampleObject").query(name=["Cool", "Cat"], createdby="Dolphin", ispublic="true"))

ezurl powers pynationstates via nsapiwrapper

######Note: This is not for URL validation nor URL Manipulation. This is simply a url generation library.