Skip to main content

No project description provided

Project description

purple_air_api (PAA)

This is a python3 wrapper for the new PurpleAirAPI (PAA). Details of the API can be found using this link: https://api.purpleair.com/#api-welcome To use the PurpleAirAPI (PAA) api keys are required. You can get API keys by sending an email to contact@purpleair.com with a first and last name to assign them to.

PyPI Distributions TestPyPI Distributions Black
Tests total download count latest release download count

How to Support This Project

Buy Me A Coffee

Purpose

This package is designed to be used for making tools around the PurpleAir API.

For example, PAA data loggers - https://github.com/carlkidcrypto/purpleair_data_logger

Installation

You can install the PurpleAir API via pip.

python3 -m pip install purple_air_api

You can install PurpleAir API by cloning down this repo.

git clone https://github.com/carlkidcrypto/purple_air_api.git
cd purple_air_api
python3 setup.py install

PurpleAirAPI Usage Example

First we need to import the PurpleAir API (PAA)

from purpleair_api.PurpleAirAPI import PurpleAirAPI

Next we need to make an instance of PAA.

my_paa = PurpleAirAPI(your_api_read_key, your_api_write_key, your_ipv4_address)

Now you can use that PAA instance to do things like...

retval = my_paa.request_sensor_data(1234)

Note: PurpleAirAPI is the main entry point. It will load read, write, and local submodules based on the parameters that are passed in upon construction. If you wish to only use a small piece of PurpleAirAPI then see the examples below.

PurpleAirReadAPI Usage Example

First we need to import the PurpleAirReadAPI.

from purpleair_api.PurpleAirReadAPI import PurpleAirReadAPI

Now we need to make an instance if it.

my_paa = PurpleAirReadAPI(api_read_key)

Now we can use that instance to do things like...

retval = my_paa.request_multiple_sensors_data("name")

PurpleAirWriteAPI Usage Example

First we need to import the PurpleAirWriteAPI.

from purpleair_api.PurpleAirWriteAPI import PurpleAirWriteAPI

Now we need to make an instance if it.

my_paa = PurpleAirWriteAPI(api_write_key)

Now we can use that instance to do things like...

retval = my_paa.post_create_member(1234)

PurpleAirLocalAPI Usage Example

First we need to import the PurpleAirLocalAPI.

from purpleair_api.PurpleAirLocalAPI import PurpleAirLocalAPI

Now we need to make an instance if it.

my_paa = PurpleAirLocalAPI(["ipv4_address"])

Now we can use that instance to do things like...

retval = my_paa.request_local_sensor_data()

Tests

Refer to the test readme

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

purpleair_api-1.1.4.tar.gz (16.5 kB view hashes)

Uploaded Source

Built Distribution

purpleair_api-1.1.4-py3-none-any.whl (15.1 kB view hashes)

Uploaded 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