{ "info": { "author": "Gitcoin", "author_email": "team@gitcoin.co", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Affero General Public License v3", "Natural Language :: English", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development", "Topic :: Software Development :: Build Tools", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# Gitcoin Python API Client\n\n[![Build Status](https://travis-ci.com/gitcoinco/python-api-client.svg?branch=master)](https://travis-ci.com/gitcoinco/python-api-client)\n\nThis Python package provides the `bounties` endpoint of the Gitcoin API, which allows you to:\n\n- list all bounties\n- list all bounties which meet certain conditions (i.e. filter them)\n- retrieve a single bounty by it's primary key\n\n## Install via pypi\n\n```bash\npip install gitcoin\n```\n\n## Usage Examples\n\n### List all bounties\n\n```python\nfrom gitcoin import Gitcoin\napi = Gitcoin()\nall_bounties = api.bounties.all()\n```\n\n### List all open bounties\n\n```python\nfrom gitcoin import Gitcoin\napi = Gitcoin()\nopen_bounties = api.bounties.filter(is_open=True).all()\n```\n\n### List all open \"Beginner\" bounties\n\n```python\nfrom gitcoin import Gitcoin\napi = Gitcoin()\nbounties_api = api.bounties\nbounties_api.filter(is_open=True)\nbounties_api.filter(experience_level='Beginner')\nopen_beginner_bounties = bounties_api.all()\n```\n\nThe example above has been reformatted for easier reading. A [fluent interface](https://en.wikipedia.org/wiki/Fluent_interface#Python) is also available. Please scroll the following code block all the way to the end to see the whole line:\n\n```python\nfrom gitcoin import Gitcoin\napi = Gitcoin()\nopen_beginner_bounties = api.bounties.filter(is_open=True, experience_level='Beginner').all()\n```\n\n### List all open bounties marked for either \"Beginner\" OR \"Intermediate\" experience level\n\nFor some filter conditions, multiple different values can be given, which results in a logical `OR` for that condition:\n\n```python\nfrom gitcoin import Gitcoin\napi = Gitcoin()\nbounties_api = api.bounties\nbounties_api.filter(is_open=True)\nbounties_api.filter(experience_level='Beginner')\nbounties_api.filter(experience_level='Intermediate')\nopen_beginner_and_intermediate_bounties = bounties_api.all()\n```\n\nThe example above has been reformatted for easier reading. A [fluent interface](https://en.wikipedia.org/wiki/Fluent_interface#Python) is also available. Please scroll the following code block all the way to the end to see the whole line:\n\n```python\nfrom gitcoin import Gitcoin\napi = Gitcoin()\nopen_beginner_and_intermediate_bounties = api.bounties.filter(is_open=True).filter(experience_level='Beginner').filter(experience_level='Intermediate').all()\n```\n\n## API\n\n### Instantiation\n\n1. Create a `Gitcoin()` API root object:\n```python\nfrom gitcoin import Gitcoin\napi = Gitcoin()\n```\n2. The `bounties` API endpoint is accessible as a property of the API root object:\n```python\nbounties_endpoint = api.bounties\n```\nEach 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.\n\n### `bounties.filter(**kwargs)`\n\nLimit 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.\n\nThe condition name is the name of the keyword argument, and the condition value is the value of the keyword argument:\n\n```python\nopen_bounties = api.bounties.filter(is_open=True).all()\n```\n\nConditions with different names can be given in one `filter()` call:\n\n```python\nopen_beginner bounties = api.bounties.filter(is_open=True, experience_level='Beginner').all()\n```\n\nOr if preferred, they can also be given in separate `filter()` calls:\n\n```python\nopen_beginner bounties = api.bounties.filter(is_open=True).filter(experience_level='Beginner').all()\n```\n\nGiving multiple values for the same filter condition has to be done in separate calls to `filter()`:\n\n```python\nbeginner_and_intermediate_bounties = api.bounties.filter(experience_level='Beginner').filter(experience_level='Intermediate').all()\n```\n\nFor the following filter conditions, multiple values can be given to achieve a logical `OR`:\n\n- `experience_level (str)`\n- `project_length (str)`\n- `bounty_type (str)`\n- `bounty_owner_address (str)`\n- `bounty_owner_github_username (str)`\n- `idx_status (str)`\n- `network (str)`\n- `standard_bounties_id (int)`\n- `github_url (str)`\n- `raw_data (str)`\n\nThe following filter conditions are **single value**, in other words, multiple values result in the last value overwriting all earlier values:\n\n- `pk__gt (int)`\n- `started (str)`\n- `is_open (bool)`\n- `fulfiller_github_username (str)`\n- `interested_github_username (str)`\n\n`filter()` returns the `Endpoint` object itself to enable a [fluent interface](https://en.wikipedia.org/wiki/Fluent_interface#Python).\n\n### `bounties.order_by(sort)`\n\nDetermine 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:\n\n- `accepted`\n- `balance`\n- `bounty_owner_address`\n- `bounty_owner_email`\n- `bounty_owner_github_username`\n- `bounty_owner_name`\n- `bounty_type`\n- `canceled_on`\n- `contract_address`\n- `current_bounty`\n- `experience_level`\n- `expires_date`\n- `fulfillment_accepted_on`\n- `fulfillment_started_on`\n- `fulfillment_submitted_on`\n- `github_comments`\n- `github_url`\n- `idx_experience_level`\n- `idx_project_length`\n- `idx_status`\n- `interested`\n- `interested_comment`\n- `is_open`\n- `issue_description`\n- `last_comment_date`\n- `metadata`\n- `network`\n- `num_fulfillments`\n- `override_status`\n- `privacy_preferences`\n- `project_length`\n- `raw_data`\n- `snooze_warnings_for_days`\n- `standard_bounties_id`\n- `submissions_comment`\n- `title`\n- `token_address`\n- `token_name`\n- `token_value_in_usdt`\n- `token_value_time_peg`\n- `_val_usd_db`\n- `value_in_eth`\n- `value_in_token`\n- `value_in_usdt`\n- `value_in_usdt_now`\n- `value_true`\n- `web3_created`\n- `web3_type`\n\n`order_by()` returns the `Endpoint` object itself to enable a [fluent interface](https://en.wikipedia.org/wiki/Fluent_interface#Python).\n\n### `bounties.get_page(number=1, per_page=25)`\n\nReturns 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()`](http://docs.python-requests.org/en/master/user/quickstart/#json-response-content) call.\n\n### `bounties.all()`\n\nReturns the complete (potentially `filter()`ed) `list` of bounties. Each bounty is a `dict`, basically the direct output of [`requests`' `.json()`](http://docs.python-requests.org/en/master/user/quickstart/#json-response-content) call.\n\n### `bounties.get(primary_key)`\n\nReturns one (1) bounty as specified by `primary_key (int)`. It is returned as a `dict`, basically the direct output of [`requests`' `.json()`](http://docs.python-requests.org/en/master/user/quickstart/#json-response-content) call.\n\n-------------------------\n\n## Todo\n\n- [x] Add base gitcoin.Gitcoin client\n- [x] Add `bounties` api filter\n - [x] Implement all filter fields present in `gitcoinco/web/app/dashboard/router.py`\n- [ ] Add `universe` api filter\n - [ ] Implement all filter fields present in `gitcoinco/web/app/external_bounties/router.py`\n- [x] Add sorting/order_by\n- [x] Add pagination (page/limit)\n- [ ] Add travis-ci.com project and twine/pypi credentials.\n- [ ] Add codecov.io project.\n- [ ] Cut first release (Tag github release, push changes, and let CI deploy to pypi)\n- [ ] Maintain +90% coverage\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/gitcoinco/python-api-client", "keywords": "gitcoin api client bounties bounty rest", "license": "", "maintainer": "", "maintainer_email": "", "name": "gitcoin", "package_url": "https://pypi.org/project/gitcoin/", "platform": "", "project_url": "https://pypi.org/project/gitcoin/", "project_urls": { "API Project": "https://github.com/gitcoinco/web", "Bug Reports": "https://github.com/gitcoinco/python-api-client/issues", "Homepage": "https://gitcoin.co", "Source": "https://github.com/gitcoinco/python-api-client/" }, "release_url": "https://pypi.org/project/gitcoin/0.1.0/", "requires_dist": [ "requests", "twine; extra == 'deploy'", "wheel; extra == 'deploy'" ], "requires_python": "~=3.5", "summary": "The Gitcoin.co python API client", "version": "0.1.0" }, "last_serial": 4176584, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "83f7345f3a4ddac5fd92d43291804311", "sha256": "59de92c232837d3fbe660b57af98c22cb59252da0a0c5314b193e142c64fcf15" }, "downloads": -1, "filename": "gitcoin-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "83f7345f3a4ddac5fd92d43291804311", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.5", "size": 17981, "upload_time": "2018-08-16T13:33:58", "url": "https://files.pythonhosted.org/packages/7d/3d/d9dd58636be41ecdec34b85e6f3f4c340c72c5eb77f6d95587b90e8d6b45/gitcoin-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ae7313b3112e7f89719ebd6018e7e4c0", "sha256": "2328bb113fcad48fe634a1687a26c68289c4591e6da8200edceeefa4ff3946f0" }, "downloads": -1, "filename": "gitcoin-0.1.0.tar.gz", "has_sig": false, "md5_digest": "ae7313b3112e7f89719ebd6018e7e4c0", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.5", "size": 18406, "upload_time": "2018-08-16T13:34:00", "url": "https://files.pythonhosted.org/packages/60/31/2e909c50016fab6631f32809537d26885693d19a84109a7f196abeff3add/gitcoin-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "83f7345f3a4ddac5fd92d43291804311", "sha256": "59de92c232837d3fbe660b57af98c22cb59252da0a0c5314b193e142c64fcf15" }, "downloads": -1, "filename": "gitcoin-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "83f7345f3a4ddac5fd92d43291804311", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.5", "size": 17981, "upload_time": "2018-08-16T13:33:58", "url": "https://files.pythonhosted.org/packages/7d/3d/d9dd58636be41ecdec34b85e6f3f4c340c72c5eb77f6d95587b90e8d6b45/gitcoin-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ae7313b3112e7f89719ebd6018e7e4c0", "sha256": "2328bb113fcad48fe634a1687a26c68289c4591e6da8200edceeefa4ff3946f0" }, "downloads": -1, "filename": "gitcoin-0.1.0.tar.gz", "has_sig": false, "md5_digest": "ae7313b3112e7f89719ebd6018e7e4c0", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.5", "size": 18406, "upload_time": "2018-08-16T13:34:00", "url": "https://files.pythonhosted.org/packages/60/31/2e909c50016fab6631f32809537d26885693d19a84109a7f196abeff3add/gitcoin-0.1.0.tar.gz" } ] }