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.
from piano_analytics_api import Client, Request
import piano_analytics_api.pfilter as pfilter
import piano_analytics_api.period as period

site_id = 0
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.Endpoint(
            'page',
            pfilter.IS_EMPTY,
            False
        ),
        pfilter.Endpoint(
            'domain',
            pfilter.CONTAINS,
            [
                '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.6.tar.gz (8.7 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.6-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: piano_analytics_api-0.0.6.tar.gz
  • Upload date:
  • Size: 8.7 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.6.tar.gz
Algorithm Hash digest
SHA256 e033846abdf46222d056c9e342da7aa3fdc9a092f35f171628618b16f0246fe2
MD5 d1b35a88332a4d5cf6e128194d57f26d
BLAKE2b-256 565c916d77abab1937f6c76e3b41f11f527211b399409dcb06e8fa88cdf8aba9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for piano_analytics_api-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 206891b4135d3098cbfefdad8a299360643651602136d790869c4f46dc8a9e84
MD5 d595170a0b8df3f4bc42bac146b25972
BLAKE2b-256 2c9b4620e743699206d53f0e6faacef25bbac1f55600066ac5204a440a75eca8

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