No project description provided
Project description
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
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file donationmanager-0.1.0.tar.gz.
File metadata
- Download URL: donationmanager-0.1.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.14.3 Linux/6.12.73-1-MANJARO
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11f1a934be7e2cba8c2c6df430ca13d93fd88b20a9adf386309de30e3d30f68d
|
|
| MD5 |
e07bda84b655663515b8478ab37c3aa2
|
|
| BLAKE2b-256 |
064149dc6bc8bb066002181e2d398b287f5aaa19a0285c320aad0122c6139c26
|
File details
Details for the file donationmanager-0.1.0-py3-none-any.whl.
File metadata
- Download URL: donationmanager-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.14.3 Linux/6.12.73-1-MANJARO
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ebbecf37a32a0fd197bb5d18dd68e90baac4f342f1657e7904085281046f2891
|
|
| MD5 |
4b165c8ab18592380c81a9548e22d60b
|
|
| BLAKE2b-256 |
fe03b9066ce63f8cf4ee3a0d45e404356969200cb2f57d3c8c1d6b32e4997426
|