Gitcoin Python API Client
This Python package provides the bounties endpoint of the Gitcoin API, which allows you to:
- list all bounties
- list all bounties which meet certain conditions (i.e. filter them)
- retrieve a single bounty by it's primary key
Install via pypi
pip install gitcoin
Usage Examples
List all bounties
from gitcoin import Gitcoin
api = Gitcoin()
all_bounties = api.bounties.all()
List all open bounties
from gitcoin import Gitcoin
api = Gitcoin()
open_bounties = api.bounties.filter(is_open=True).all()
List all open "Beginner" bounties
from gitcoin import Gitcoin
api = Gitcoin()
bounties_api = api.bounties
bounties_api.filter(is_open=True)
bounties_api.filter(experience_level='Beginner')
open_beginner_bounties = bounties_api.all()
The example above has been reformatted for easier reading. A fluent interface is also available. Please scroll the following code block all the way to the end to see the whole line:
from gitcoin import Gitcoin
api = Gitcoin()
open_beginner_bounties = api.bounties.filter(is_open=True, experience_level='Beginner').all()
List all open bounties marked for either "Beginner" OR "Intermediate" experience level
For some filter conditions, multiple different values can be given, which results in a logical OR for that condition:
from gitcoin import Gitcoin
api = Gitcoin()
bounties_api = api.bounties
bounties_api.filter(is_open=True)
bounties_api.filter(experience_level='Beginner')
bounties_api.filter(experience_level='Intermediate')
open_beginner_and_intermediate_bounties = bounties_api.all()
The example above has been reformatted for easier reading. A fluent interface is also available. Please scroll the following code block all the way to the end to see the whole line:
from gitcoin import Gitcoin
api = Gitcoin()
open_beginner_and_intermediate_bounties = api.bounties.filter(is_open=True).filter(experience_level='Beginner').filter(experience_level='Intermediate').all()
API
Instantiation
- Create a
Gitcoin()API root object:
from gitcoin import Gitcoin
api = Gitcoin()
- The
bountiesAPI endpoint is accessible as a property of the API root object:
bounties_endpoint = api.bounties
Each access to the bounties property results in a new Endpoint object with no filter conditions or any other parameters (like sorting) set. If you want to keep a specific set of filter conditions, simply store the Endpoint object in a variable instead of referring to the bounties property of the root object.
bounties.filter(**kwargs)
Limit the list of bounties returned by either get_page() or all() to those bounties meeting the filter condition(s). For some filter conditions, multiple different values can be given, which results in a logical OR for that condition.
The condition name is the name of the keyword argument, and the condition value is the value of the keyword argument:
open_bounties = api.bounties.filter(is_open=True).all()
Conditions with different names can be given in one filter() call:
open_beginner bounties = api.bounties.filter(is_open=True, experience_level='Beginner').all()
Or if preferred, they can also be given in separate filter() calls:
open_beginner bounties = api.bounties.filter(is_open=True).filter(experience_level='Beginner').all()
Giving multiple values for the same filter condition has to be done in separate calls to filter():
beginner_and_intermediate_bounties = api.bounties.filter(experience_level='Beginner').filter(experience_level='Intermediate').all()
For the following filter conditions, multiple values can be given to achieve a logical OR:
experience_level (str)project_length (str)bounty_type (str)bounty_owner_address (str)bounty_owner_github_username (str)idx_status (str)network (str)standard_bounties_id (int)github_url (str)raw_data (str)
The following filter conditions are single value, in other words, multiple values result in the last value overwriting all earlier values:
pk__gt (int)started (str)is_open (bool)fulfiller_github_username (str)interested_github_username (str)
filter() returns the Endpoint object itself to enable a fluent interface.
bounties.order_by(sort)
Determine the order of the bounties returned by either get_page() or all(). The sort argument is a string containing a DB field name to sort by. It can also have an optional "-" prefix for reversing the direction. Choose from these field names:
acceptedbalancebounty_owner_addressbounty_owner_emailbounty_owner_github_usernamebounty_owner_namebounty_typecanceled_oncontract_addresscurrent_bountyexperience_levelexpires_datefulfillment_accepted_onfulfillment_started_onfulfillment_submitted_ongithub_commentsgithub_urlidx_experience_levelidx_project_lengthidx_statusinterestedinterested_commentis_openissue_descriptionlast_comment_datemetadatanetworknum_fulfillmentsoverride_statusprivacy_preferencesproject_lengthraw_datasnooze_warnings_for_daysstandard_bounties_idsubmissions_commenttitletoken_addresstoken_nametoken_value_in_usdttoken_value_time_peg_val_usd_dbvalue_in_ethvalue_in_tokenvalue_in_usdtvalue_in_usdt_nowvalue_trueweb3_createdweb3_type
order_by() returns the Endpoint object itself to enable a fluent interface.
bounties.get_page(number=1, per_page=25)
Returns one page of the (potentially filter()ed) list of bounties with the given 1-based index number (int). The page size can be set with per_page (int). Each bounty is a dict, basically the direct output of requests' .json() call.
bounties.all()
Returns the complete (potentially filter()ed) list of bounties. Each bounty is a dict, basically the direct output of requests' .json() call.
bounties.get(primary_key)
Returns one (1) bounty as specified by primary_key (int). It is returned as a dict, basically the direct output of requests' .json() call.
Todo
- Add base gitcoin.Gitcoin client
- Add
bountiesapi filter- Implement all filter fields present in
gitcoinco/web/app/dashboard/router.py
- Implement all filter fields present in
- Add
universeapi filter- Implement all filter fields present in
gitcoinco/web/app/external_bounties/router.py
- Implement all filter fields present in
- Add sorting/order_by
- Add pagination (page/limit)
- Add travis-ci.com project and twine/pypi credentials.
- Add codecov.io project.
- Cut first release (Tag github release, push changes, and let CI deploy to pypi)
- Maintain +90% coverage
Metadata
Release files for gitcoin 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gitcoin-0.1.0.tar.gz | 18.4 kB | Without provenance | Details for gitcoin-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gitcoin-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for gitcoin-0.1.0-py3-none-any.whl |
Total release size: 36.4 kB
Release files / gitcoin-0.1.0.tar.gz
| Download URL | gitcoin-0.1.0.tar.gz |
|---|---|
| Size | 18.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2328bb113fcad48fe634a1687a26c68289c4591e6da8200edceeefa4ff3946f0
|
|
BLAKE2b-256 checksum How to use checksums |
60312e909c50016fab6631f32809537d26885693d19a84109a7f196abeff3add
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0
|
Release files / gitcoin-0.1.0-py3-none-any.whl
| Download URL | gitcoin-0.1.0-py3-none-any.whl |
|---|---|
| Size | 18.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
59de92c232837d3fbe660b57af98c22cb59252da0a0c5314b193e142c64fcf15
|
|
BLAKE2b-256 checksum How to use checksums |
7d3dd9dd58636be41ecdec34b85e6f3f4c340c72c5eb77f6d95587b90e8d6b45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0
|
Security for gitcoin 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.