# pndatapush Python module to push data to the Pervasive Nation IoT network. It saves data locally until there is internet access.
#To install
`python pip install --upgrade pndatapush `
#To run an example
`python python examples/gatherdata.py `
# Easiest way to add to your project Create an instance of the Offline class.
`python from pndatapush.offline import Offline from pndatapush.pushdata import PNPushData #Set the PervasiveNation Auth token pnpushdata = PNPushData(pervasivenation_authtoken="MYREALLYLONGTOKENIGOTSECRET") offline = Offline(payload_consumers=[pnpushdata]) `
## OR if you want to use environment variables:
` #set your PervasiveNation Auth token by using an environment variable before starting your applicaiton export PERVASIVENATION_AUTHTOKEN="MYREALLYLONGTOKENIGOTSECRET" `
`python from pndatapush.offline import Offline from pndatapush.pushdata import PNPushData offline = Offline(payload_consumers=[PNPushData]) #PNPushData is a data consumer class. see pnpushdata.pushdata.PNPushData `
## AND if you want the local database in your current directory:
`python import os from pndatapush.offline import Offline from pndatapush.pushdata import PNPushData #Set the PervasiveNation Auth token pnpushdata = PNPushData(pervasivenation_authtoken="MYREALLYLONGTOKENIGOTSECRET") #Set the local SQLite DB path offline = Offline(payload_consumers=[pnpushdata], dbpath='sqlite:///%s/sensordata.db' % os.path.dirname(os.path.realpath(__file__))) `
Then when sensor data is received save the data
`python device_identifier = '12456' offline.save(device_identifier, 30.00) #save(self, deviceid, payload): `
Changelog
0.0.1 (2016-04-13)
First release on PyPI.
Release files for pndatapush 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pndatapush-0.0.3.tar.gz | 9.5 kB | Details |
Release files / pndatapush-0.0.3.tar.gz
| Download URL | pndatapush-0.0.3.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
275fe20caae1d93178e5754b70d95ab0661f3e0ce5486705e3a28c4ded6ad33f
|
|
BLAKE2b-256 checksum How to use checksums |
23b5cf15bf243d479806c22592ded4043ce8c1b3f66f6fe86ebf3283a77fc361
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |