analytix is a simple yet powerful API wrapper to make getting analytical information from your favourite services easier than ever.
Project description
analytix
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
Built Distribution
Hashes for analytix-0.1.0a1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d0f15c1b8becc45cb7e3e3ed18fefbfbb5652c6ec359e9b2877a9e69a7ab09f |
|
MD5 | 436c2b719750f0f4178d0cd76c1515d3 |
|
BLAKE2b-256 | bb92e44aa409f022778caade0dc662b5a2d1e82d6986f0d56bf6c87d522ebd9b |