Skip to main content

Monkey patches for setting user-agent header.

Project description

Monkey patches for setting user-agent header.

# Importing hooks automatically handles monkey patching
from setuseragent import hooks
# We can set to a specific value
hooks.set_user_agent("my-new-user-agent")
# Or we can set it with a package version
hooks.set_distribution('my-package')
# or using meta package name
hooks.set_distribution(__package__)

If using Django, can optionally set the site name as part of the package

# in settings.py

INSTALLED_APPS = [
    ...,
    "setuseragent.django",
    "django.contrib.sites",
]

# Optionally can configure a specific package to lookup.
# otherwise defaults to the value of DJANGO_SETTINGS_MODULE
USER_AGENT_DISTRIBUTION = __package__

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

setuseragent-0.4.0.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

setuseragent-0.4.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file setuseragent-0.4.0.tar.gz.

File metadata

  • Download URL: setuseragent-0.4.0.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.8

File hashes

Hashes for setuseragent-0.4.0.tar.gz
Algorithm Hash digest
SHA256 f22cdb5d62c5713ea408ee5fcfeff0575b079029e153d69a9ead66a6ff56854b
MD5 c1485aa5ecce020830b219257321953e
BLAKE2b-256 ad7622ff92e476968054758db1ac710402d186e2bf91868cf60eb78b22dfba1c

See more details on using hashes here.

File details

Details for the file setuseragent-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for setuseragent-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c93d5d89b8b7360883e56250f9f1e3df3b9dd553a08461ba6c8ef27a32660ec
MD5 ab2bf37c450b5dfb2e9227d811b223f1
BLAKE2b-256 bd4e35c632d5fd8268a229396b6378dbc2597c14935ac71ee5afee1af4dff5ef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page