Skip to main content

A simple yet powerful wrapper for the YouTube Analytics API.

Project description

analytix

PyPi version PyPI - Status Downloads GitHub last commit License

CI (Tests) Read the Docs Maintainability Test Coverage

A simple yet powerful wrapper for the YouTube Analytics API.

CPython versions 3.6 through 3.11-dev and PyPy versions 3.6 and 3.7 are officially supported.

Windows, MacOS, and Linux are all supported.

Features

  • Pythonic syntax lets you feel right at home
  • Dynamic error handling saves hours of troubleshooting, and makes sure only valid requests count toward your API quota
  • A clever interface allows you to make multiple requests across multiple sessions without reauthorising
  • Extra support allows the native saving of CSV files and conversion to DataFrame objects
  • Easy enough for beginners, but powerful enough for advanced users

Installation

You need Python 3.6.0 or greater to run analytix.

To install the latest stable version of analytix, use the following command:

pip install analytix

To install with optional dependencies, use the following command:

pip install "analytix[opt]"

You can also install the latest development version using the following command:

pip install git+https://github.com/parafoxia/analytix

You may need to prefix these commands with a call to the Python interpreter depending on your OS and Python configuration.

Quickstart

Before you begin, you will need to have a Google Developers project with the YouTube Analytics API enabled. You can find instructions on how to do that in the API setup guide.

Once you've done that, retrieving reports is easy. The below example loads credentials from a secrets file, and gets as much information as possible from the last 28 days.

import datetime as dt

from analytix import YouTubeAnalytics

client = YouTubeAnalytics.from_file("./secrets.json")
start_date = dt.date.today() - dt.timedelta(days=28)
report = client.retrieve(start_date, dimensions=("day",))
report.to_csv("./analytics-28d.csv")

From version 2.1, you can do the same operation in an easier way.

from analytix import YouTubeAnalytics

client = YouTubeAnalytics.from_file("./secrets.json")
report = client.daily_analytics().to_csv("./analytics-28d.csv")

To read up further, have a look at the documentation.

Contributing

analytix is open to contributions. To find out where to get started, have a look at the contributing guide.

License

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

Project details


Download files

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

Files for analytix, version 2.2.0.post0
Filename, size File type Python version Upload date Hashes
Filename, size analytix-2.2.0.post0.tar.gz (21.9 kB) File type Source Python version None Upload date Hashes View
Filename, size analytix-2.2.0.post0-py3-none-any.whl (29.9 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page