Skip to main content

A Python API client for interacting with the Gumroad API.

Project description

Gumroad API Client

A Python API client for interacting with the Gumroad API (https://gumroad.com/api). Comments, suggestions, and improvements are always welcome. Be sure to follow @opsdisk on Twitter for the latest updates.

Note that not all of the endpoints and HTTP verbs supported by the Gumroad API have been added.

Installation

pip install pygumroad
git clone https://github.com/opsdisk/pygumroad.git
cd pygumroad
virtualenv -p python3.7 .venv  # If using a virtual environment.
source .venv/bin/activate  # If using a virtual environment.
pip install -r requirements.txt
python setup.py install

Update Credentials

If using a secrets file, create/update the gumroad_secrets.json file with the host and API key. See the usage section on how to pass a secrets dictionary.

cp gumroad_secrets_empty.json gumroad_secrets.json
{
    "gumroad": {
        "host": "api.gumroad.com",
        "token": "7a4d...b388",
    }
}

Usage

import pygumroad

# Pass a secrets file.
full_path_to_secrets_file_location="/home/user/gumroad_secrets.json"
gumroad_client = pygumroad.GumroadClient(secrets_file_location=full_path_to_secrets_file_location)

# Pass a secrets dictionary.
secrets_dict = {
    "gumroad": {
        "host": "api.gumroad.com",
        "token": "7a4d...b388",
    }
}

gumroad_client = pygumroad.GumroadClient(secrets_dict=secrets_dict)
all_products = gumroad_client.retrieve_all_products()

for product in all_products:
    print(f"Product Name: {product['name']} - Product ID: {product['id']}")


all_sales = gumroad_client.retrieve_all_sales()

for sale in all_sales:
    print(f"Product: {sale['product_name']} was sold on {sale['created_at']}")

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

pygumroad-0.0.3.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

pygumroad-0.0.3-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file pygumroad-0.0.3.tar.gz.

File metadata

  • Download URL: pygumroad-0.0.3.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for pygumroad-0.0.3.tar.gz
Algorithm Hash digest
SHA256 d9638e1e17468b02abe9ee3dae65d7e7a89798e6d5390517a52f7f5f0950a03f
MD5 b7085421b94bf419f924632964617db7
BLAKE2b-256 bb2889fdf5286fca43b0acc2bc565efe26bbccbfa73b9ab617b36423fe2009ed

See more details on using hashes here.

File details

Details for the file pygumroad-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: pygumroad-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 23.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for pygumroad-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4ea0bda92c317035af005bc55a109db9fe4834f9a53b5dfd84204e4b18a91c0f
MD5 8ba934fa89faca65226baed08d6c886b
BLAKE2b-256 684084b1ff4b8c48f39e34d34a51da31767365db4d05db48796c11e24f71f78c

See more details on using hashes here.

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