From f97ae0e49b08c6e768cf04fbe20845d870aaef54 Mon Sep 17 00:00:00 2001 From: Ethan Henderson Date: Mon, 26 Jul 2021 02:16:39 +0100 Subject: [PATCH] Updated docs --- docs/conf.py | 2 +- docs/starting/first-report.rst | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index e6e0dd2..0203948 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -38,7 +38,7 @@ "sphinx.ext.intersphinx", "sphinx_rtd_dark_mode", ] -autodoc_member_order = 'bysource' +autodoc_member_order = "bysource" # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] diff --git a/docs/starting/first-report.rst b/docs/starting/first-report.rst index 9accd0b..2e65fbf 100644 --- a/docs/starting/first-report.rst +++ b/docs/starting/first-report.rst @@ -48,11 +48,17 @@ You can retrieve reports using the client's :code:`retrieve` method. This method dimensions=("day",), ) +In this example, the first argument (:code:`dt.date.today() - dt.timedelta(days=28)`) is the date in which data should be collected from. You need to supply this for every request you make. It must also be a :code:`datetime.date` object, and *not* a :code:`datetime.datetime` object. + .. note:: If you're retrieving reports containing revenue data, some dates may be missing as revenue analytics are typically delayed by a few days. analytix does not account for this. -In this example, the first argument (:code:`dt.date.today() - dt.timedelta(days=28)`) is the date in which data should be collected from. You need to supply this for every request you make. It must also be a :code:`datetime.date` object, and *not* a :code:`datetime.datetime` object. +From version 2.1, there is an easier way of retrieving some simple reports in the form of factory methods. These are limited in their capabilites, but can massively speed up common retrievals. These factory methods also account for delayed revenue analytics in some situations. Here's the previous example done again taking advantage of one of these factory methods: + +.. code-block:: python + + report = client.daily_analytics(metrics=("views", "likes", "comments")) Once the report has been retrieved, you can either save it as a JSON file, save it as a CSV file, or convert it to a pandas DataFrame (provided pandas is currently installed). Note that the JSON file would contain the raw data from the API: