Skip to content

Python Request Builder for Google Analytics Reporting API v4

License

Notifications You must be signed in to change notification settings

czuhajster/garb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GARB - Google Analytics Request Builder

License: MIT Code Size Last Commit PyPI Version

GARB is a small Python library that provides an object-oriented interface for building requests for Google Analytics Reporting API v4.

Installation

Using pip

Install garb using pip:

pip install garb

Usage

Using Google API Client

  1. Build a request body, e.g.:
import garb

# ...


date_ranges = [garb.daterange.DateRange('7daysAgo', 'today')]
metrics = [garb.metric.Metric('ga:sessions')]
report_requests = [garb.report_request.ReportRequest(VIEW_ID, date_ranges, metrics)]
request_body = garb.report_request.RequestBody(report_requests)
  1. Pass a RequestBody object as a parameter to the batchGet method:
def get_report(analytics):
    return analytics.reports().batchGet(body=request_body).execute()

License

GARB is licensed under MIT License.

About

Python Request Builder for Google Analytics Reporting API v4

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages