Skip to main content

Pushdata Python client library

This library allows you to easily store and retrieve time series data using the online service pushdata.io.

Installation

pip install pushdata-io

Getting started

You can start storing data on pushdata.io immediately, without even registering an account there. Just install this package and write three lines of code, like this:

import pushdata

pd = pushdata.Client(email="youremail@yourdomain.com", tsname="MyTimeseries")
pd.send(12345)  # Stores the data point 12345, timestamped with the current date and time

After you've run the code and stored at least one data point, go to https://pushdata.io/youremail@yourdomain.com where you will be able to view your timeseries.

Usage

import pushdata

# 1. Initialize with no authentication
# Initialize with our account email and time series name we want to use
pd = pushdata.Client(email="myemail@example.com", tsname="mytimeseries")

# 2. ...or initialize with authentication (for account with security=on)
pd = pushdata.Client(apikey="thd8JT73LsB8jah0F4d9", tsname="mytimeseries")

# Send a data point to the time series
pd.send(4711)

# Send to another time series by overriding tsname
pd.send(4711, tsname="myothertimeseries")

# Retrieve all data from the time series
response = pd.recv()

# Or from another time series
response = pd.recv(tsname="anothertimeseries")

# Retrieve data timestamped during the last week
import datetime
one_week_ago = datetime.datetime.now() - datetime.timedelta(days=7)
response = pd.recv(fromtime=one_week_ago)

# Retrieve data for one 24-hour period, one week ago
import datetime
one_week_ago = datetime.datetime.now() - datetime.timedelta(days=7)
one_week_ago_plus_24h = one_week_ago + datetime.timedelta(days=1)
response = pd.recv(fromtime=one_week_ago, totime=one_week_ago_plus_24h)

#
# Print time series data
#
# We get a Python Requests response object from recv(), which 
# includes response code, raw HTTP response body, and more.
# We use the .json() method to parse the body text as JSON
# and get a dictionary:
tsdata = response.json()
#
# And then we print stuff:
print("Timeseries name: " + tsdata["name"])
print("First point recorded at   : " + tsdata["first"])    # timestamp of first point in time series
print("Last point recorded at    : " + tsdata["last"])     # timestamp of last point in time series
print("Total number of points    : " + tsdata["total"])    # total number of points in timeseries
print("Number of points returned : " + tsdata["returned"]) # number of points returned in this call
print("---- Points ----")
for point in tsdata["points"]:
    print("Time=%s value=%f" % (point["time"], point["value"]))

#
# tsdata (the decoded JSON response from pushdata.io) is 
# a dictionary that looks like this:
#  {
#     "name": "mytimeseries",
#     "first": "2019-02-15T07:43:31.546805Z",
#     "last": "2019-03-05T11:21:06.20951Z",
#     "total": 482,
#     "returned: 482,
#     "offset": 0,
#     "limit": 10000,
#     "points": [
#        {
#           "time": "2019-02-15T07:43:31.546805Z",
#           "value": 4711.0
#        },
#        ...
#     ]
#  }
#
# See https://speca.io/ragnarlonn/pushdata-io#TimeSeriesData
#

Metadata

Release files for pushdata-io 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pushdata-io 0.1.0
File Size Uploaded Provenance
pushdata-io-0.1.0.tar.gz 3.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pushdata-io 0.1.0
File Interpreter ABI Platform
pushdata_io-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.7 kB

Release files / pushdata-io-0.1.0.tar.gz

Download URL pushdata-io-0.1.0.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b4b1f3fb117245dcd5532aa44c0551fe9c1ae934550a879ce88e76fdbbbae7f7
BLAKE2b-256 checksum
How to use checksums
3733b941a1066bcdbde0bb2c11245d901d4c2da0de4ea420f4900ef8e794cd9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release files / pushdata_io-0.1.0-py3-none-any.whl

Download URL pushdata_io-0.1.0-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0a6be36bdfe0b53fc70e82224ff2e63a1b86f3dba0acb8b9a6adabb1e53381e
BLAKE2b-256 checksum
How to use checksums
52debc66ae500657a047edcae19ec8734b7cba4c9fa5e917b9b67dfe7f3c3404
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Security for pushdata-io 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page