Package Halberd :: Module util
[hide private]
[frames] | no frames]

Module util

source code

Miscellaneous functions.

Functions [hide private]
 
_gen_table()
Generate translation table.
source code
 
utctime() source code
str
hostname(url)
Get the hostname part of an URL.
source code
tuple
addresses(host)
Get the network addresses to which a given host resolves to.
source code
Variables [hide private]
str table = '________________________________________________01234...
Translation table for normalizing strings.
  __package__ = 'Halberd'
Function Details [hide private]

hostname(url)

source code 

Get the hostname part of an URL.

Parameters:
  • url (str) - A valid URL (must be preceded by scheme://).
Returns: str
Hostname corresponding to the URL or the empty string in case of failure.

addresses(host)

source code 

Get the network addresses to which a given host resolves to.

Parameters:
  • host (str) - Hostname we want to resolve.
Returns: tuple
Network addresses.

Variables Details [hide private]

table

Translation table for normalizing strings.
Type:
str
Value:
'________________________________________________0123456789_______ABCD\
EFGHIJKLMNOPQRSTUVWXYZ______abcdefghijklmnopqrstuvwxyz________________\
______________________________________________________________________\
_______________________________________________'