- Notifications
You must be signed in to change notification settings - Fork1
The library makes parsing and manipulation of URL🌐 and Email address📧 easy.
License
NotificationsYou must be signed in to change notification settings
y-bar/netcleanser
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The library makes parsing and manipulation of URL🌐 and Email address📧 easy.
pip install netcleanser
>>>fromnetcleanserimportEmail>>>email=Email('shinichi.takayanagi@gmail.com')>>>email.domain'gmail.com'>>>email.local_part'shinichi.takayanagi'>>>email.is_validTrue>>>email.value'shinichi.takayanagi@gmail.com'
ThisEmail
class issettable
anddictable
# As a dict key>>>x= {email:1}>>>x[email]1# As elemtns of set>>>email2=Email("nakamichiworks@gmail.com")>>> {email,email,email,email2,email2}{Email(value='nakamichiworks@gmail.com)',Email(value='shinichi.takayanagi@gmail.com)'}
Email.build()
allows you to create dummy email address specifing the only part oflocal_part
ordomain
>>>Email.build(local_part="hoge")Email(value='hoge@dummy.com)'>>>Email.build(domain="hoge.com")Email(value='dummy@hoge.com)'
>>>fromnetcleanserimportUrl>>>url=Url('https://www.google.com/search?q=auhuhe')>>>url.scheme'https'>>>url.host'www.google.com'>>>url.domain'www.google.com'>>>url.registered_domain'google.com'>>>url.netloc'www.google.com'>>>url.path'/search'>>>url.query'q=auhuhe'>>>url.is_validTrue>>>url.is_accessibleTrue>>>url.value'https://www.google.com/search?q=auhuhe'>>>str(url)'https://www.google.com/search?q=auhuhe'>>>url.contains_wwwTrue>>>url.remove_query()Url(host='www.google.com',username='None',password='None',scheme='https',port='None',path='/search',query='',fragment='')>>>url.remove_www()Url(host='google.com',username='None',password='None',scheme='https',port='None',path='/search',query='q=auhuhe',fragment='')
ThisUrl
class issettable
anddictable
>>>x= {url:123}>>>x[Url('https://www.google.com/search?q=auhuhe')]123>>> {url,url,Url('https://google.com'),url}{Url(host='www.google.com',username='None',password='None',scheme='https',port='None',path='/search',query='q=auhuhe',fragment=''),Url(host='google.com',username='None',password='None',scheme='https',port='None',path='',query='',fragment='')}
Url
class strongly depends on awesomepurl package, thanks!
About
The library makes parsing and manipulation of URL🌐 and Email address📧 easy.