Skip to main content

Python implementation for the Piano Anaytics Reporting API (formerly ‘At Internet’)

Project description

Piano analytics (formerly ‘AT Internet’) Python client

This library enables you to get queries from the Piano Analytics Reporting API v3. This is a third-party library. A subscription to Piano Analytics is required.

Requirements

Installation

You can use Pip or Download the Release

Pip

The preferred method is via the Python package index.

pip3 install piano-analytics-api

Usage example

  1. Create an API key in your Piano Analytics account.
  2. Get the access key and secret key from the API key.
  3. Find the site ID’s in Piano Analytics access management. Select a site on the page and copy the id from the address bar.
import piano_analytics_api.period as period
import piano_analytics_api.pfilter as pfilter
from piano_analytics_api import Client, Request

site_id = 614694
access_key = ""
secret_key = ""

# Create API connection
client = Client(access_key, secret_key)

# Get page titles and number of visits for each page,
# where the page title is not empty and domain is example.com,
# ordered by the number of visits from high to low.
request = Request(
    client=client,
    sites=[site_id],
    columns=["page", "m_visits"],
    period=period.today(),
    sort=["-m_visits"],
    property_filter=pfilter.ListAnd(
        pfilter.IsEmpty("page", False),
        pfilter.Contains("domain", ["example.com", "www.example.com"])
    )
)

# All results
i = 0
for item in request.get_result_rows():
    print(item)
    i += 1

# Number of results
print(f"rowcount: {request.get_rowcount()}")

# Cumulative metrics for all resulting rows
print(f"total: {request.get_total()}")

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

piano_analytics_api-0.0.8.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

piano_analytics_api-0.0.8-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file piano_analytics_api-0.0.8.tar.gz.

File metadata

  • Download URL: piano_analytics_api-0.0.8.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for piano_analytics_api-0.0.8.tar.gz
Algorithm Hash digest
SHA256 b12e8bf11dd9a821d3241e2afd224979b85e14621d841d614639f74529df182d
MD5 5822024c026150d976bbcb0203765ca2
BLAKE2b-256 a8ee8dc8fc4d720a8e1a6e6a6e2e246937632d697a44f9f9643975504e8346c5

See more details on using hashes here.

File details

Details for the file piano_analytics_api-0.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for piano_analytics_api-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 38ece1f45b2f6ce63faad3e4ec604617e79a82d6297626165a4cd0d3364e1220
MD5 d1a3c8566e1023da35b0548c873f4b19
BLAKE2b-256 be966269fffaab8671964dfdb753d84b1b6dd27b7ec0ee7babec7fee05f95504

See more details on using hashes here.

Supported by

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