# crowdAI API
![build status](https://api.travis-ci.org/crowdAI/crowdai_api.svg?branch=master)
python client for server side API of the [crowdai.org](https://www.crowdai.org) webapp.
* Free software: GNU General Public License v3
* Documentation: https://crowdai-api.readthedocs.io.
# Installation
## Deployment
```bash
pip install git+https://github.com/crowdAI/crowdai_api.git
```
## Development
```bash
git clone https://github.com/crowdAI/crowdai_api
cd crowdai_api
pip install -r requirements_dev.txt
pip install -e .
```
# Usage
## Instantiate API object
```python
from crowdai_api import API as CROWDAI_API
auth_token="<YOUR CROWDAI AUTH TOKEN>"
api = CROWDAI_API(auth_token)
```
## Authenticate participant
* with `API_KEY`
```python
api.authenticate_participant(EXAMPLE_API_KEY)
```
* with `username`
```python
api_key = api.authenticate_participant_with_username("spMohanty")
```
## Get all Submissions
```python
challenge_id = "test_challenge"
submissions = api.get_all_submissions(challenge_id)
print(submissions)
```
## Create Submission
```python
challenge_id = "test_challenge"
submission = api.create_submission(challenge_id)
print(submission)
# Output
# ========================================
# CrowdAISubmission : 5261
# challenge_id : test_challenge
# round_id : False
# score : False
# score_secondary : False
# grading_status : submitted
# message :
# ========================================
```
## Get submission
```python
submission_id = 5262
challenge_id = "test_challenge"
submission = api.get_submission(challenge_id, submission_id)
```
## Update submission
Assuming you have a `submission` object by using `api.create_submission` or `api.get_submission`.
You can update the submission by :
```python
# Update params
submission.grading_status = "graded"
submission.score = 0.98
submission.score_secondary = 0.98
submission.update()
print(submission)
# Output#
# ========================================
# CrowdAISubmission : 5262
# challenge_id : test_challenge
# round_id : False
# score : 0.98
# score_secondary : 0.98
# grading_status : graded
# message :
# ========================================
```
# Tests
```bash
# Setup the environment varriables
cp environ.sh.example environ.sh
# Then modify the respective environment variables
source environ.sh
pytests tests/
```
# Author
S.P.Mohanty <sharada.mohanty@epfl.ch>
Raw data
{
"_id": null,
"home_page": "https://github.com/crowdai/crowdai_api",
"name": "crowdai-api",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "crowdai_api crowdai",
"author": "S.P. Mohanty",
"author_email": "spmohanty91@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/0c/ee/55912b05af8994a190280e3281a18720f8d69da02dcb7ff44e1b96974345/crowdai_api-0.1.22.tar.gz",
"platform": "",
"description": "# crowdAI API\n![build status](https://api.travis-ci.org/crowdAI/crowdai_api.svg?branch=master) \n\npython client for server side API of the [crowdai.org](https://www.crowdai.org) webapp.\n\n* Free software: GNU General Public License v3\n* Documentation: https://crowdai-api.readthedocs.io.\n\n# Installation\n## Deployment\n```bash\npip install git+https://github.com/crowdAI/crowdai_api.git\n```\n## Development\n```bash\ngit clone https://github.com/crowdAI/crowdai_api\ncd crowdai_api\npip install -r requirements_dev.txt\npip install -e .\n```\n# Usage\n## Instantiate API object\n```python\nfrom crowdai_api import API as CROWDAI_API\nauth_token=\"<YOUR CROWDAI AUTH TOKEN>\"\napi = CROWDAI_API(auth_token)\n```\n\n## Authenticate participant\n* with `API_KEY`\n```python\napi.authenticate_participant(EXAMPLE_API_KEY)\n```\n* with `username`\n```python\napi_key = api.authenticate_participant_with_username(\"spMohanty\")\n```\n## Get all Submissions\n```python\n\nchallenge_id = \"test_challenge\"\nsubmissions = api.get_all_submissions(challenge_id)\nprint(submissions)\n```\n## Create Submission\n```python\nchallenge_id = \"test_challenge\"\nsubmission = api.create_submission(challenge_id)\nprint(submission)\n# Output\n# ========================================\n# CrowdAISubmission\t:\t5261\n# \tchallenge_id\t:\ttest_challenge\n# \tround_id\t:\tFalse\n# \tscore\t:\tFalse\n# \tscore_secondary\t:\tFalse\n# \tgrading_status\t:\tsubmitted\n# \tmessage\t:\n# ========================================\n```\n\n## Get submission\n```python\nsubmission_id = 5262\nchallenge_id = \"test_challenge\"\nsubmission = api.get_submission(challenge_id, submission_id)\n```\n\n## Update submission\nAssuming you have a `submission` object by using `api.create_submission` or `api.get_submission`.\nYou can update the submission by :\n\n```python\n# Update params\nsubmission.grading_status = \"graded\"\nsubmission.score = 0.98\nsubmission.score_secondary = 0.98\nsubmission.update()\nprint(submission)\n# Output#\n# ========================================\n# CrowdAISubmission\t:\t5262\n# \tchallenge_id\t:\ttest_challenge\n# \tround_id\t:\tFalse\n# \tscore\t:\t0.98\n# \tscore_secondary\t:\t0.98\n# \tgrading_status\t:\tgraded\n# \tmessage\t:\n# ========================================\n```\n\n# Tests\n```bash\n# Setup the environment varriables\ncp environ.sh.example environ.sh\n# Then modify the respective environment variables\nsource environ.sh\npytests tests/\n```\n\n# Author\nS.P.Mohanty <sharada.mohanty@epfl.ch>",
"bugtrack_url": null,
"license": "GNU General Public License v3",
"summary": "python api for interacting with crowdAI grading infrastructure",
"version": "0.1.22",
"project_urls": {
"Homepage": "https://github.com/crowdai/crowdai_api"
},
"split_keywords": [
"crowdai_api",
"crowdai"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0cee55912b05af8994a190280e3281a18720f8d69da02dcb7ff44e1b96974345",
"md5": "1a8dc48997c146982a507e03aaebfb19",
"sha256": "2a7a2bc54fb90229420fc2ae43148ea78913e11dcc95b129e99380f2b15d0a96"
},
"downloads": -1,
"filename": "crowdai_api-0.1.22.tar.gz",
"has_sig": false,
"md5_digest": "1a8dc48997c146982a507e03aaebfb19",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9197,
"upload_time": "2019-08-17T10:24:51",
"upload_time_iso_8601": "2019-08-17T10:24:51.328878Z",
"url": "https://files.pythonhosted.org/packages/0c/ee/55912b05af8994a190280e3281a18720f8d69da02dcb7ff44e1b96974345/crowdai_api-0.1.22.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2019-08-17 10:24:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "crowdai",
"github_project": "crowdai_api",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "crowdai-api"
}