Package: d8s-urls
Democritus UrlsDemocritus functions[1]for working with URLs.[1] Democritus functions aresimple, effective, modular, well-tested, and well-documentedPython functions.We used8s(pronounced "dee-eights") as an abbreviation fordemocritus(you can read more about thishere).Installationpip install d8s-urlsUsageYou import the library like:fromd8s_urlsimport*Once imported, you can use any of the functions listed below.Functionsdefurl_scheme(url:str)->str:"""Return the scheme of the url."""defurl_fragment(url:str)->str:"""Return the fragment of the url."""defurl_examples(n:int=10)->List[str]:"""Create n URLs."""defurls_find(text:str,*,domain_name:str='',**kwargs)->List[str]:"""Parse URLs from the given text. If a domain name is given, only urls with the given domain name will be returned."""defurl_canonical_form(url:str)->str:"""Get the canonical url."""defurl_scheme_remove(url:str):"""Remove the scheme from the given URL."""defurl_query_strings_remove(url:str)->str:"""Return the URL without any query strings."""defurl_query_strings(url:str)->Dict[str,List[str]]:"""Return all of the query strings in the url."""defurl_query_string(url:str,query_string:str)->List[str]:"""Return the value of the given query string in the given url."""defurl_query_string_add(url:str,query_string_field:str,query_string_value:str)->str:"""."""defurl_query_string_remove(url:str,query_string_field_to_remove:str)->str:"""Remove the query string at the given field."""defurl_query_string_replace(url:str,query_string_field:str,query_string_value:str)->str:"""."""defurl_path(url:str)->str:"""Return the path of the url."""defurl_path_segments(url:str)->List[str]:"""Return all of the segments of the url path."""defurl_fragments_remove(url:str)->str:"""Return the URL without any fragments."""defurl_file_name(url:str)->str:"""Get the file name of the URL."""defurl_domain(url:str)->str:"""Return the domain of the given URL."""defget_first_arg_url_domain(func):"""If the first argument is a url, get the domain of the url and pass that into the function."""defurl_domain_second_level_name(url:str)->str:"""Find the second level domain name for the URL (e.g. 'http://example.com/test/bingo' => 'example') (see https://en.wikipedia.org/wiki/Domain_name#Second-level_and_lower_level_domains)."""defurl_join(url:str,path:str):"""Join the URL to the URL path."""defis_url(possible_url:str)->bool:"""Check if the given string is a URL."""defurl_screenshot(url:str,output_file_path:str='')->bytes:"""."""defurl_as_punycode(url:str)->str:"""Convert the domain name of the URL to Punycode."""defurl_as_unicode(url:str)->str:"""Convert the domain name of the URL to Unicode."""defurl_simple_form(url:str)->str:"""Return the URL without query strings or fragments."""defurl_schemes()->List[str]:"""Get the url schemes from https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml."""defurl_from_google_redirect(url:str)->Optional[str]:"""Get the url from the google redirect."""defurl_encode(url:str)->str:"""Encode the URL using percent encoding (see https://en.wikipedia.org/wiki/Percent-escape)."""defurl_decode(url:str)->str:"""Decode a percent encoded URL (see https://en.wikipedia.org/wiki/Percent-escape)."""defurl_base_form(url:str)->str:"""Get the base URL without a path, query strings, or other junk."""defurl_rank(url:str)->int:"""."""Development👋  If you want to get involved in this project, we have some short, helpful guides below:contribute to this project 🥇test it 🧪lint it 🧹explore it 🔭If you have any questions or there is anything we did not cover, please raise an issue and we'll be happy to help.CreditsThis package was created withCookiecutterand Floyd Hightower'sPython project template.