autopush.utils

autopush.utils.canonical_url(scheme, hostname, port=None)[source]

Return a canonical URL given a scheme/hostname and optional port

autopush.utils.resolve_ip(hostname)[source]

Resolve a hostname to its IP if possible

autopush.utils.validate_uaid(uaid)[source]

Validates a UAID a tuple indicating if its valid and the original uaid, or a new uaid if its invalid

autopush.utils.generate_hash(key, payload)[source]

Generate a HMAC for the uaid using the secret

Returns:HMAC hash and the nonce used as a tuple (nonce, hash).