The zaqar.common.urls module

create_signed_url(key, paths, project=None, expires=None, methods=None)

Creates a signed url for the specified path

This function will create a pre-signed URL for path using the specified options or the default ones. The signature will be the hex value of the hmac created using key

Parameters:
  • key – A string to use as a key for the hmac generation.
  • paths – A list of strings representing URL paths.
  • project – (Default None) The ID of the project this URL belongs to.
  • methods – (Default [‘GET’]) A list of methods that will be supported by the generated URL.
Params expires:

(Default time() + 86400) The expiration date for the generated URL.

verify_signed_headers_data(key, paths, project, signature, methods, expires)

Verify that signature matches for the given values

Parameters:
  • key – A string to use as a key for the hmac generation.
  • paths – A list of strings representing URL paths.
  • project – The ID of the project this URL belongs to.
  • signature – The pre-generated signature
  • methods – A list of methods that will be supported by the generated URL.
Params expires:

The expiration date for the generated URL.