Package tlib :: Package base :: Module NetworkHelper :: Class NetworkHelper
[hide private]
[frames] | no frames]

Class NetworkHelper

source code

object --+
         |
        NetworkHelper

Helper functions for parsing URLs and validating emails and URLs

Instance Methods [hide private]

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
 
get_hostname_from_url(url)
Extracts hostname from an URL in the format...
source code
 
get_scheme_from_url(url)
Extracts scheme from an URL in the format...
source code
 
get_path_from_url(url)
Extracts path from an URL in the format...
source code
 
get_port_from_url(url)
Extracts port from an URL in the format...
source code
 
get_username_from_url(url)
Extracts username from an URL in the format...
source code
 
get_password_from_url(url)
Extracts password from an URL in the format...
source code
 
get_params_from_url(url)
Extracts params from an URL in the format...
source code
 
get_query_string_from_url(url)
Extracts query from an URL in the format...
source code
 
get_ip_from_hostname(hostname)
Resolves a hostname and returns the corresponding IP address
source code
bool
is_valid_url(url)
Validates a URL
source code
bool
is_valid_email(email)
Validates an email
source code
bool
is_absolute_url(url)
Validates if a URL is relative or absolute
source code
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

get_hostname_from_url(url)
Static Method

source code 

Extracts hostname from an URL in the format
 <scheme>://<username>:<password>@<hostname>:<port>/<path>;<params>?<query>#<fragment>
@param url: URL to process
@type url: str

get_scheme_from_url(url)
Static Method

source code 

Extracts scheme from an URL in the format
 <scheme>://<username>:<password>@<hostname>:<port>/<path>;<params>?<query>#<fragment>
@param url: URL to process
@type url: str

get_path_from_url(url)
Static Method

source code 

Extracts path from an URL in the format
 <scheme>://<username>:<password>@<hostname>:<port>/<path>;<params>?<query>#<fragment>
@param url: URL to process
@type url: str

get_port_from_url(url)
Static Method

source code 

Extracts port from an URL in the format
 <scheme>://<username>:<password>@<hostname>:<port>/<path>;<params>?<query>#<fragment>
@param url: URL to process
@type url: str

get_username_from_url(url)
Static Method

source code 

Extracts username from an URL in the format
 <scheme>://<username>:<password>@<hostname>:<port>/<path>;<params>?<query>#<fragment>
@param url: URL to process
@type url: str

get_password_from_url(url)
Static Method

source code 

Extracts password from an URL in the format
 <scheme>://<username>:<password>@<hostname>:<port>/<path>;<params>?<query>#<fragment>
@param url: URL to process
@type url: str

get_params_from_url(url)
Static Method

source code 

Extracts params from an URL in the format
 <scheme>://<username>:<password>@<hostname>:<port>/<path>;<params>?<query>#<fragment>
@param url: URL to process
@type url: str

get_query_string_from_url(url)
Static Method

source code 

Extracts query from an URL in the format
 <scheme>://<username>:<password>@<hostname>:<port>/<path>;<params>?<query>#<fragment>
@param url: URL to process
@type url: str

get_ip_from_hostname(hostname)
Static Method

source code 

Resolves a hostname and returns the corresponding IP address

Parameters:
  • hostname (str) - Hostname to resolve

is_valid_url(url)
Static Method

source code 

Validates a URL

Parameters:
  • url (str) - URL to validate
Returns: bool

is_valid_email(email)
Static Method

source code 

Validates an email

Parameters:
  • email (str) - eMail to validate
Returns: bool

is_absolute_url(url)
Static Method

source code 

Validates if a URL is relative or absolute

Parameters:
  • url (str) - URL to validate
Returns: bool