Skip to main content

A Python client for Mozilla's basket service.

Project description

This is a client for Mozilla’s email subscription service, basket. Basket is not a real subscription service, but it talks to a real one and we don’t really care who/what it is.

There are four API methods: subscribe, unsubscribe, user, and update_user. View the basket documentation for details.

Usage

Are you looking to integrate this on a site for email subscriptions? All you need to do is:

import basket

basket.subscribe(‘<email>’, ‘<newsletter>’, <kwargs>)

You can pass additional fields as keyword arguments, such as format and country. For a list of available fields and newsletters, see the basket documentation.

Are you checking to see if a user was successfully subscribed? You can use the debug-user method like so:

import basket

basket.debug_user(‘<email>’, ‘<supertoken>’)

And it return full details about the user. <supertoken> is a special token that grants you admin access to the data. Check with the mozilla.org developers to get it.

Settings

BASKET_URL

URL to basket server, e.g. https://basket.mozilla.com

If you’re using Django you can simply add this setting to your settings.py file. Otherwise basket-client will look for this value in a BASKET_URL environment variable. The default is http://localhost:8000.

Change Log

v0.3.4

  • Fix issue with calling subscribe with an iterable of newsletters.

  • Add request function to those exposed by the basket` module.

v0.3.3

  • Add get_newsletters API method for information on currently available newsletters.

  • Handle Timeout exceptions from requests.

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

basket-client-0.3.4.tar.gz (4.6 kB view details)

Uploaded Source

File details

Details for the file basket-client-0.3.4.tar.gz.

File metadata

File hashes

Hashes for basket-client-0.3.4.tar.gz
Algorithm Hash digest
SHA256 0ebd4a0eb3df3bf0448a5e7caf86cd9b1548333993919d7619b9b92862886238
MD5 98e2dfe5e2851532e6799f80af9a9406
BLAKE2b-256 006a98321aa27c3af1975c5ca5391c5911ee1d8957fa6eca6c50ea470d595fa7

See more details on using hashes here.

Provenance

Supported by

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