Skip to content

Commit ba337d6

Browse files
authored
Merge pull request #39 from dynata/dev
Release 1.0.2
2 parents eed6597 + 350eec0 commit ba337d6

File tree

4 files changed

+75
-41
lines changed

4 files changed

+75
-41
lines changed

.github/workflows/pythonpackage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: python-tests
22

3-
on: [push]
3+
on: [push, pull_request]
44

55
jobs:
66
build:

README.md

Lines changed: 71 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,108 @@
11
# python-demandapi-client
22

3+
[![PyPI version](https://badge.fury.io/py/dynatademand.svg)](https://pypi.org/project/dynatademand/)
4+
35
<a href="https://github.com/dynata/python-demandapi-client/actions?query=branch%3Adev"><img alt="GitHub Actions status" src="https://github.com/dynata/python-demandapi-client/workflows/python-tests/badge.svg"></a>
46

5-
A Python client library for the [Dynata Demand API](https://developers.dynata.com/)
7+
A Python client library for the [Dynata Demand API](https://developers.dynata.com/). There are also [go](https://github.com/researchnow/go-samplifyapi-client) and [.NET](https://github.com/researchnow/dotnet-samplifyapi-client) clients available.
8+
69
## Setup
710

8-
The client requires environment variables to be set for the Dynata Demand API credentials. These can be found in `.env-example`.
11+
You can install the Demand API client with:
12+
13+
pip install dynatademand
14+
15+
You can provide your Demand API credentials in a couple of ways. They can be set in the environment (a sample config is provided in `.env-example`) or you can provide them while creating the client object.
916

1017
## Example Usage
1118

12-
demandapi = DemandAPIClient()
13-
demandapi.authenticate()
14-
demandapi.logout()
19+
```python
20+
# You can optionally provide your credentials here instead of environment variables.
21+
demandapi = DemandAPIClient("client_id", "username", "password")
22+
demandapi.authenticate()
23+
24+
# Any function requiring one or more IDs should be provided as positional arguments.
25+
demandapi.get_project(7)
26+
27+
# Provide query parameters as keyword-arguments.
28+
demandapi.get_projects(state="LAUNCHED")
29+
30+
# Functions that send data in a request body accept a python dictionary.
31+
# Your data will be validated against the schemas provided in the Demand API documentation.
32+
project_data = {
33+
'title': 'My New Survey',
34+
...
35+
}
36+
demandapi.create_project(project_data)
37+
```
1538

1639
## Supported API Functions
1740

41+
Links to the Demand API documentation are included for each function.
42+
1843
### Authentication Functions
1944

20-
authenticate()
21-
refresh_access_token()
22-
logout()
45+
[Obtain Access Token](https://developers.dynata.com/demand-api-reference/authentication/authentication/post-token): authenticate()
46+
[Refresh Access Token](https://developers.dynata.com/demand-api-reference/authentication/authentication/post-token-refresh): refresh_access_token()
47+
[Logout](https://developers.dynata.com/demand-api-reference/authentication/authentication/post-logout): logout()
2348

2449
### Event Functions
2550

26-
get_event(event_id)
27-
get_events(\*\*kwargs)
51+
[Get Event](https://developers.dynata.com/demand-api-reference/notifications/events/get-event): get_event(event_id)
52+
[Get Events](https://developers.dynata.com/demand-api-reference/notifications/events/get-events): get_events(\*\*kwargs)
2853

2954
### Project Functions
3055

31-
buy_project(project_id, buy_data)
32-
close_project(project_id)
33-
create_project(project_data)
34-
get_project(project_id)
35-
get_projects(\*\*kwargs)
36-
reconcile_project(project_id, reconcile_data)
37-
update_project(project_id, update_data)
38-
get_project_detailed_report(project_id)
39-
get_feasibility(project_id)
40-
get_invoice(project_id)
56+
[Buy Project](https://developers.dynata.com/demand-api-reference/core-resources/projects/post-project-buy): buy_project(project_id, buy_data)
57+
[Close Project](https://developers.dynata.com/demand-api-reference/core-resources/projects/post-close-project): close_project(project_id)
58+
[Create Project](https://developers.dynata.com/demand-api-reference/core-resources/projects/post-projects): create_project(project_data)
59+
[Get Project](https://developers.dynata.com/demand-api-reference/core-resources/projects/get-project): get_project(project_id)
60+
[Get Projects](https://developers.dynata.com/demand-api-reference/core-resources/projects/get-projects): get_projects(\*\*kwargs)
61+
[Update Project](https://developers.dynata.com/demand-api-reference/core-resources/projects/post-project): update_project(project_id, update_data)
62+
[Get Project Detailed Report](https://developers.dynata.com/demand-api-reference/core-resources/projects/get-project-detailed-report): get_project_detailed_report(project_id)
63+
[Get Pricing & Feasibility](https://developers.dynata.com/demand-api-reference/core-resources/pricing-feasibility/get-pricing-feasibility): get_feasibility(project_id)
64+
[Get Invoice PDF](https://developers.dynata.com/demand-api-reference/billing_invoicing/invoicing/get-invoices): get_invoice(project_id)
4165

4266
### Line Item Functions
4367

44-
add_line_item(project_id, lineitem_data)
45-
close_line_item(project_id, line_item_id)
46-
get_line_item(project_id, line_item_id)
47-
get_line_items(project_id, \*\*kwargs)
48-
launch_line_item(project_id, line_item_id)
49-
pause_line_item(project_id, line_item_id)
50-
update_line_item(project_id, line_item_id, line_item_data)
51-
get_line_item_detailed_report(project_id, line_item_id)
68+
[Add Line Item](https://developers.dynata.com/demand-api-reference/core-resources/lineitems/post-lineitems): add_line_item(project_id, lineitem_data)
69+
[Close Line Item](https://developers.dynata.com/demand-api-reference/core-resources/lineitems/post-lineitem-close): close_line_item(project_id, line_item_id)
70+
[Get Line Item](https://developers.dynata.com/demand-api-reference/core-resources/lineitems/get-lineitem): get_line_item(project_id, line_item_id)
71+
[Get Line Items](https://developers.dynata.com/demand-api-reference/core-resources/lineitems/get-lineitems): get_line_items(project_id, \*\*kwargs)
72+
[Launch Line Item](https://developers.dynata.com/demand-api-reference/core-resources/lineitems/post-lineitem-launch): launch_line_item(project_id, line_item_id)
73+
[Pause Line Item](https://developers.dynata.com/demand-api-reference/core-resources/lineitems/post-lineitem-pause): pause_line_item(project_id, line_item_id)
74+
[Update Line Item](https://developers.dynata.com/demand-api-reference/core-resources/lineitems/post-lineitem): update_line_item(project_id, line_item_id, line_item_data)
75+
[Get Line Item Detailed Report](https://developers.dynata.com/demand-api-reference/core-resources/lineitems/get-detailed-line-item): get_line_item_detailed_report(project_id, line_item_id)
5276

5377
### Misc Functions
5478

55-
get_attributes(country_code, language_code, \*\*kwargs)
56-
get_countries(\*\*kwargs)
57-
get_sources()
58-
get_survey_topics(\*\*kwargs)
79+
[Get Attributes](https://developers.dynata.com/demand-api-reference/data_endpoints/attributes/get-attributes): get_attributes(country_code, language_code, \*\*kwargs)
80+
[Get Countries](https://developers.dynata.com/demand-api-reference/data_endpoints/countries-languages/get-countries): get_countries(\*\*kwargs)
81+
[Get Sources](https://developers.dynata.com/demand-api-reference/data_endpoints/supplier-sources/get-sources): get_sources()
82+
[Get Survey Topics](https://developers.dynata.com/demand-api-reference/data_endpoints/categories/get-survey-topic): get_survey_topics(\*\*kwargs)
5983

6084
## Contributing
6185

6286
Information on [contributing](CONTRIBUTING.md).
6387

6488
## Testing
6589

66-
To run the tests,
90+
To run the tests, you will need to install the development requirements to your environment. It's recommended to create a virtual environment for your installation to avoid any package conflicts.
91+
92+
You can check out the code by running:
93+
94+
git clone https://github.com/dynata/python-demandapi-client.git
95+
cd python-demandapi-client
6796

97+
And you can create an environment by running:
98+
99+
# If you're using Python 2.7
68100
virtualenv venv
69-
. venv/bin/activate
101+
102+
# Or if you're using Python 3:
103+
python3 -m venv venv
104+
105+
source venv/bin/activate
70106
pip install -r requirements.txt
71-
pytest tests
72-
deactivate
73107

74-
to run the tests for this project.
108+
While your virtual environment is activated, you can run `pytest tests` to run the tests.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[tool.poetry]
22
name = "dynatademand"
3-
version = "1.0.1"
3+
version = "1.0.2"
44
description = "A Python client library for the Dynata Demand API"
55
authors = ["Ridley Larsen <Ridley.Larsen@dynata.com>", "Bradley Wogsland <Bradley.Wogsland@dynata.com>", "Nathan Workman <Nathan.Workman@dynata.com>"]
66

77
[tool.poetry.dependencies]
8-
python = "^2.7"
8+
python = "^2.7 || ^3.5 || ^3.6 || ^3.7"
99
responses = "0.10.6"
1010
requests = "2.22.0"
1111
pytest = "4.6.6"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name='dynata-demandapi-client',
5-
version="1.0.1",
5+
version="1.0.2",
66
license="MIT",
77
description="A Python client library for the Dynata Demand API",
88
long_description="A Python client library for the Dynata Demand API",

0 commit comments

Comments
 (0)