mopidy.httpclient — HTTP Client helpers

Helpers for configuring HTTP clients used in Mopidy extensions.

mopidy.httpclient.format_proxy(proxy_config, auth=True) str | None[source]

Convert a Mopidy proxy config to the commonly used proxy string format.

Outputs scheme://host:port, scheme://user:pass@host:port or None depending on the proxy config provided.

You can also opt out of getting the basic auth by setting auth to False. :rtype: str | None

New in version 1.1.

mopidy.httpclient.format_user_agent(name=None) str[source]

Construct a User-Agent suitable for use in client code.

This will identify use by the provided name (which should be on the format dist_name/version), Mopidy version and Python version. :rtype: str

New in version 1.1.