Skip to content

Commit 3795b83

Browse files
author
Daniel B
authored
Merge pull request #1 from mattmanley/build_scaffolding
Build initial scaffolding for project
2 parents 90af651 + 28445b9 commit 3795b83

23 files changed

Lines changed: 847 additions & 0 deletions

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
tox.ini
2+
venv
3+
.eggs
4+
.idea
5+
.tox
6+
*.pyc
7+
__pycache__
8+
maproulette.egg-info

.sonarcloud.properties

Whitespace-only changes.

.travis.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
language: python
2+
python:
3+
- "3.6"
4+
# command to install dependencies
5+
install:
6+
- pip install -r requirements.txt
7+
# command to run unit tests
8+
script:
9+
- tox

examples/__init__.py

Whitespace-only changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import json
2+
import maproulette
3+
4+
# Create a configuration object using an API key
5+
configuration = maproulette.Configuration(api_key='{YOUR_API_KEY}')
6+
7+
# Create an API object using your config object
8+
api = maproulette.Api(configuration)
9+
10+
# Initialize a project model using the project name
11+
my_project = maproulette.ProjectModel(name='my_new_project_name_20200120_abc')
12+
13+
# You can set other parameters like your project description like this:
14+
my_project.description = 'my project description'
15+
16+
# Print the API response
17+
print(json.dumps(api.create_project(my_project), indent=4, sort_keys=True))

examples/find_project.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import maproulette
2+
import json
3+
4+
# Create a configuration object using a url and API key
5+
config = maproulette.Configuration(api_key='{YOUR_API_KEY}')
6+
7+
# Create an API object using your config object
8+
api = maproulette.Api(config)
9+
10+
# We want to fetch a project with name 'Health Facilities in India'
11+
my_project_name = 'Health Facilities in India'
12+
13+
# Print the API response
14+
print(json.dumps(api.find_project(my_project_name), indent=4, sort_keys=True))

examples/get_project_by_id.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import maproulette
2+
import json
3+
4+
# Create a configuration object using an API key
5+
config = maproulette.Configuration(api_key='{YOUR_API_KEY}')
6+
7+
# Create an API object using your config object
8+
api = maproulette.Api(config)
9+
10+
# We want to fetch a project with ID '4719'
11+
my_project_id = '4719'
12+
13+
# Print the API response
14+
print(json.dumps(api.get_project_by_id(my_project_id), indent=4, sort_keys=True))

examples/get_project_by_name.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import maproulette
2+
import json
3+
4+
# Create a configuration object using an API key
5+
config = maproulette.Configuration(api_key='YOUR_API_KEY')
6+
7+
# Create an API object using your config object
8+
api = maproulette.Api(config)
9+
10+
# We want to fetch a project with name 'Health Facilities in India'
11+
my_project_name = 'Health Facilities in India'
12+
13+
# Print the API response
14+
print(json.dumps(api.get_project_by_name(my_project_name), indent=4, sort_keys=True))

examples/get_project_challenges.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import maproulette
2+
import json
3+
4+
# Create a configuration object using a url and API key
5+
config = maproulette.Configuration(api_key='YOUR_API_KEY')
6+
7+
# Create an API object using your config object
8+
api = maproulette.Api(config)
9+
10+
# The ID of the project whose challenges I want to fetch is 4719
11+
my_project_id = '4719'
12+
13+
# Print the API response
14+
print(json.dumps(api.get_project_challenges(my_project_id), indent=4, sort_keys=True))

examples/get_project_children.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import maproulette
2+
import json
3+
4+
# Create a configuration object using an API key
5+
config = maproulette.Configuration(api_key='YOUR_API_KEY')
6+
7+
# Create an API object using your config object
8+
api = maproulette.Api(config)
9+
10+
# The ID of the project whose children I want to fetch is 4719
11+
my_project_id = '4719'
12+
13+
# Print the API response
14+
print(json.dumps(api.get_project_children(my_project_id), indent=4, sort_keys=True))

0 commit comments

Comments
 (0)