https://github.com/opsdisk/pygumroad
A Python API client for interacting with the Gumroad API
https://github.com/opsdisk/pygumroad
api automation gumroad python
Last synced: 5 months ago
JSON representation
A Python API client for interacting with the Gumroad API
- Host: GitHub
- URL: https://github.com/opsdisk/pygumroad
- Owner: opsdisk
- License: gpl-3.0
- Created: 2020-09-10T02:23:19.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-05-24T02:17:46.000Z (11 months ago)
- Last Synced: 2024-11-02T22:52:06.237Z (6 months ago)
- Topics: api, automation, gumroad, python
- Language: Python
- Homepage:
- Size: 35.2 KB
- Stars: 15
- Watchers: 4
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Gumroad API Client
A Python API client for interacting with the Gumroad API (). Comments, suggestions, and
improvements are always welcome. Be sure to follow [@opsdisk](https://twitter.com/opsdisk) on Twitter for the latest
updates.```none
Note that not all of the endpoints and HTTP verbs supported by the Gumroad API have been added.
```## Installation
```bash
pip install pygumroad
``````bash
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.```bash
cp gumroad_secrets_empty.json gumroad_secrets.json
``````json
{
"gumroad": {
"host": "api.gumroad.com",
"token": "7a4d...b388",
}
}
```## Usage
```python
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']}")```