Skip to main content

Usage

Importing

Find the link to your API link for your donations (For help finding your link go to Donor Drive API: How tos). Import the module into your python project as normal

[!IMPORTANT] Currently the import is fairly messy, and has to be imported a little confusingly, see the example code below

Creating a new Donation Manager class

After importing the DonationTracker class can be initialized like any other python object, requiring a url to your DonorDrive donation API Link

Optionally, after the URL, a second string giving the name for the json file. The format is <PATH>/<FILENAME>.json inputting any other filetype into the method raises a TypeError

Using the get_new_donations() method

Any DonationTracker object can get the get_new_donations() method. Calling this method requests the donation Json from the Donor Drive API for the participant's link

The method calls the API, which returns JSON data. It then checks if there is already a local donos.json. The return from this method is an array of the format [number of new donations, new donations json]

The Json returned in the array is formatted as a python dictionary inside of an array this is a little strange, however it is a byproduct of Python's built-in Json Handler Module. This format allows interchangability between Json (for file handling) and usage in python. It is essential the formatting is not changed, as doing so may lead to malformed JSON file output.

An example of the output of this is as follows

[1, [{'displayName': 'Johnpaul Shields', 'donorID': '79D83C498A38FBB3', 'links': {'recipient': 'https://www.extra-life.org/participants/566838', 'donate': 'https://www.extra-life.org/participants/566838/donate'
}, 'isRegFee': False, 'eventID': 562, 'createdDateUTC': '2026-02-20T21:14:29.923Z', 'recipientName': 'Johnpaul Shields', 'recipientImageURL': 'https://donordrivecontent.com/extralife/images/$avatars$/constituen
t_E4B21B29-DD36-DBF8-79D83C498A38FBB3.jpg?v=1771442940259', 'message': 'Test Dono 2', 'participantID': 566838, 'amount': 1.0, 'donorIsRecipient': True, 'avatarImageURL': 'https://donordrivecontent.com/extralife
/images/$avatars$/constituent_E4B21B29-DD36-DBF8-79D83C498A38FBB3.jpg?v=1771442940259', 'donationID': '235890E3214394E3'}]]

The method then writes the new data to the json file allowing the method to be used again. When no new donations are given, the method returns [0, '{}'] of which '{}' is an empty json list

Using the get_last_cached_donation() method

Just like the get_new_donations() method, the get_last_cached_donation() method returns JSON data. However, it does not return an array like get_new_donations() does. Instead it returns just raw cached donation data, and if there is none it returns a '{}'. The biggest difference between this method and get_new_donations() is that get_last_cached_donation() does NOT make an API request; Instead it checks if there is already a json file with the donation data and if there is, returns the latest donation. This was added as a way to get the "cached" donation data without making an API request.

An example of the output of this method is as follows:

  • If there is a file
{'displayName': 'Johnpaul Shields', 'donorID': '79D83C498A38FBB3', 'links': {'recipient': 'https://www.extra-life.org/participants/566838', 'd
onate': 'https://www.extra-life.org/participants/566838/donate'}, 'isRegFee': False, 'eventID': 562, 'createdDateUTC': '2026-02-20T21:14:29.92
3Z', 'recipientName': 'Johnpaul Shields', 'recipientImageURL': 'https://donordrivecontent.com/extralife/images/$avatars$/constituent_E4B21B29-
DD36-DBF8-79D83C498A38FBB3.jpg?v=1773862012806', 'message': 'Test Dono 2', 'participantID': 566838, 'amount': 1.0, 'donorIsRecipient': True, '
avatarImageURL': 'https://donordrivecontent.com/extralife/images/$avatars$/constituent_E4B21B29-DD36-DBF8-79D83C498A38FBB3.jpg?v=1773862012806
', 'donationID': '235890E3214394E3'}
  • If there is no file
{}

Using the get_cached_donation() method

Just like the get_cached_donations() method, the get_cached_donation() method returns JSON data (not in an array) and doesn't make an API request. It takes in one argument (an integer) donation_index and returns the donation in the cached data at that index. After a recent push, get_last_cached_donation() now uses this method at donation_index of 0. If the index is not an integer or is out of bounds, the method gives an error in the standard output and returns an empty json '{}'

Example of Usage

from donationmanager import DonoTracker

url = 'https://www.extra-life.org/api/1.6/participants/minismeef/donations'
donotracker = DonoTracker.DonationTracker(url)

if __name__ == '__main__':
    new_donations = donotracker.get_new_donations()
    print(new_donations)

Metadata

Release files for donationmanager 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for donationmanager 2.0.0
File Size Uploaded
donationmanager-2.0.0.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for donationmanager 2.0.0
File Interpreter ABI Platform
donationmanager-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.3 kB

Release files / donationmanager-2.0.0.tar.gz

Download URL donationmanager-2.0.0.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6859d1f993db8cd3adbf58b0ec54327f6cbb370bb5f3b49b76ef2bb432277a2e
BLAKE2b-256 checksum
How to use checksums
87b5c6acb788ead4b0d518e5e8b7463fd14c870fe7aa943675fac9c7514df0d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.14.3 Linux/6.19.9-arch1-1

Release files / donationmanager-2.0.0-py3-none-any.whl

Download URL donationmanager-2.0.0-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1177b9886969388214fc2fdcd1c5226243e04db3070d672625ef2cf05336dff5
BLAKE2b-256 checksum
How to use checksums
16d391216da393d0d6f30b88a5b1aa09db31a2af094cd91364fd3d80edc35659
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.14.3 Linux/6.19.9-arch1-1

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page