Skip to main content

analytix is a simple yet powerful API wrapper to make getting analytical information from your favourite services easier than ever.

Project description

analytix

PyPi version PyPI pyversions License

analytix is a simple yet powerful API wrapper to make getting analytical information from your favourite services easier than ever. Note: Only the YouTube Anaytics API is supported as this time, though more will be added over time!

Installation

Python 3.6 or greater is required.

You can install the latest version of analytix using the following command:

# Linux/macOS
python3 -m pip install -U analytix

# Windows
py -3 -m pip install -U analytix

# In a virtual environment
pip install analytix

You can also install the development version by running the following (this example assumes you're on Linux/macOS):

$ git clone https://github.com/parafoxia/analytix
$ cd analytix
$ git checkout develop
$ python3 -m pip install -U .

Getting started

To get started with analytix, have a look at the documentation.

Quick example

The following example shows you how to save a CSV of day-by-day analytics for 2020 from the YouTube Analytics API:

import datetime as dt

from analytics.youtube import TimeBasedYouTubeAnalytics, YouTubeService

service = YouTubeService("./secrets.json")  # Load from secrets file
service.authorise("yt-analytics.readonly", "yt-analytics-monetary.readonly")
analytics = TimeBasedYouTubeAnalytics(service)
report = analytics.retrieve(
    ("views", "likes", "comments"),
    start_date=dt.date(2020, 1, 1),
    end_date=dt.date(2020, 12, 31),
    dimensions=("day",)
)
report.to_csv("./analytics.csv")

You can also import the following to get all available metrics (note that some report types support different metrics):

from analytix.youtube.features import YOUTUBE_ANALYTICS_DEFAULT_METRICS

Contributing

If you're interested in contributing to analytix, check out the contributing guide.

License

The analytix module for Python is licensed under the BSD-3-Clause License.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

analytix-0.1.0a1.tar.gz (7.0 kB view hashes)

Uploaded Source

Built Distribution

analytix-0.1.0a1-py3-none-any.whl (8.3 kB view hashes)

Uploaded Python 3

Supported by

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