| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This Python package provides the bounties endpoint of the Gitcoin API, which allows you to:
pip install gitcoinfrom gitcoin import Gitcoin
api = Gitcoin()
all_bounties = api.bounties.all()from gitcoin import Gitcoin
api = Gitcoin()
open_bounties = api.bounties.filter(is_open=True).all()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()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()from gitcoin import Gitcoin
api = Gitcoin()bounties_endpoint = api.bountiesEach 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.
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:
The following filter conditions are single value, in other words, multiple values result in the last value overwriting all earlier values:
filter() returns the Endpoint object itself to enable a fluent interface.
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:
order_by() returns the Endpoint object itself to enable a fluent interface.
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.
Returns the complete (potentially filter()ed) list of bounties. Each bounty is a dict, basically the direct output of requests' .json() call.
Returns one (1) bounty as specified by primary_key (int). It is returned as a dict, basically the direct output of requests' .json() call.
| Back | FazBrowse Home | New Git URL |