Utilities¶
-
altapay.utils.
etree_to_dict
(tree)¶ Note: This is an internal API and may be changed without notice.
-
altapay.utils.
handle_xml_value
(value)¶ The AltaPay XML does not contain a scheme, and as such, guesswork has to be employed in order to produce decent values.
This function parses values of the decoded XML, and ensures both digits and boolean values.
Note: This is an internal API and may be changed without notice.
Parameters: value – value to be parsed (can be a complex datatype) Return type: depends on the input argument
-
altapay.utils.
http_build_query
(payload)¶ Build a query string that matches the way PHP does it with
http_build_query
.In output, this function loosely matches what PHP does in the function
http_build_query
. It handles complex types of both dict and list.If
collections.OrderedDict
is used, the order of the keys will be preserved in the finalized query string.Note: This is an internal API and may be changed without notice.
Parameters: payload – the payload to convert to a query string. This has to be dict
compatible, but can hold lists as values in the dictionary. Nested dictionaries can be used, and lists can hold dictionaries.Return type: string
that can be used as a GET parameter for HTTP requests
-
altapay.utils.
to_pythonic_name
(name)¶ Create a Pythonic version of a string.
Note: This is an internal API and may be changed without notice.
Parameters: name – string to build a Pythonic version of. Return type: string
-
altapay.utils.
to_pythonic_dict
(dictionary)¶ Note: This is an internal API and may be changed without notice.