Giter VIP home page Giter VIP logo

carlkidcrypto / purpleair_api Goto Github PK

View Code? Open in Web Editor NEW
2.0 4.0 1.0 3.52 MB

A Python3 wrapper written for the new PurpleAir API [https://api.purpleair.com/]. Find this package on pypi: https://pypi.org/project/purpleair-api/#history You can grab your own sensor here: https://www2.purpleair.com/

Home Page: https://carlkidcrypto.github.io/purpleair_api/

License: MIT License

Python 98.29% Makefile 0.82% Batchfile 0.89%
purpleairapi python python3 purpleair-api purpleair purpleair-sensor

purpleair_api's Introduction

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 [email protected] 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

purpleair_api's People

Contributors

carlkidcrypto avatar dependabot[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

praful-dodda

purpleair_api's Issues

Add New API Endpoints

https://api.purpleair.com/

What's new in 1.0.12
You can now request public and / or private data from the history API.
This new feature is controlled through the use of a privacy parameter on the history end points. Along with this new parameter is a data column called private that will always be included when private and public data appears in the same response. The possible values for this column will be listed in the privacy field. See the documentation below for more details.

What's new in 1.0.13
Points and other account details are now available from the /organization endpoint.
Information previously only available in the Developer Dashboard is now programmatically accessible through the API. This includes the remaining points and consumption rate enabling dynamic code behavior. Try sending a sample request to obtain your organization's information using the documentation below.

Unit Tests

Investigate adding unit tests for the code in this repo.
The tests should be easy to run. More importantly they should run quickly so that the feedback loop is small.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.