Skip to main content

A Python client library for the Dynata Demand API

Project description


PyPI version

GitHub Actions status

A Python client library for the Dynata Demand API. There are also go and .NET clients available.


You can install the Demand API client with:

pip install dynatademand

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.

Example Usage

# You can optionally provide your credentials here instead of environment variables.
demandapi = DemandAPIClient("client_id", "username", "password")

# Any function requiring one or more IDs should be provided as positional arguments.

# Provide query parameters as keyword-arguments.

# Functions that send data in a request body accept a python dictionary.
# Your data will be validated against the schemas provided in the Demand API documentation.
project_data = {
  'title': 'My New Survey',

Supported API Functions

Links to the Demand API documentation are included for each function.

Authentication Functions

Obtain Access Token: authenticate()
Refresh Access Token: refresh_access_token()
Logout: logout()

Event Functions

Get Event: get_event(event_id)
Get Events: get_events(**kwargs)

Project Functions

Buy Project: buy_project(project_id, buy_data)
Close Project: close_project(project_id)
Create Project: create_project(project_data)
Get Project: get_project(project_id)
Get Projects: get_projects(**kwargs)
Update Project: update_project(project_id, update_data)
Get Project Detailed Report: get_project_detailed_report(project_id)
Get Pricing & Feasibility: get_feasibility(project_id)
Get Invoice PDF: get_invoice(project_id)
Get Invoices Summary PDF: get_invoices_summary(**kwargs)

Line Item Functions

Add Line Item: add_line_item(project_id, lineitem_data)
Close Line Item: close_line_item(project_id, line_item_id)
Get Line Item: get_line_item(project_id, line_item_id)
Get Line Items: get_line_items(project_id, **kwargs)
Launch Line Item: launch_line_item(project_id, line_item_id)
Pause Line Item: pause_line_item(project_id, line_item_id)
Update Line Item: update_line_item(project_id, line_item_id, line_item_data)
Get Line Item Detailed Report: get_line_item_detailed_report(project_id, line_item_id) Launch Quota cell: set_quotacell_status(project_id, line_item_id, quota_cell_id, launch)
Pause Quota cell: set_quotacell_status(project_id, line_item_id, quota_cell_id, pause)

Misc Functions

Get Attributes: get_attributes(country_code, language_code, **kwargs)
Get Countries: get_countries(**kwargs)
Get Sources: get_sources()
Get Survey Topics: get_survey_topics(**kwargs)


Information on contributing.


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.

You can check out the code by running:

git clone
cd python-demandapi-client

And you can create an environment by running:

# If you're using Python 2.7
virtualenv venv

# Or if you're using Python 3:
python3 -m venv venv

source venv/bin/activate
pip install -r requirements.txt

While your virtual environment is activated, you can run pytest tests to run the tests.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dynatademand-1.0.5.tar.gz (15.5 kB view hashes)

Uploaded Source

Built Distribution

dynatademand-1.0.5-py2.py3-none-any.whl (30.9 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page