Skip to main content

A python wrapper that connects to multiple 3rd party resources for AWS.

Project description

data-tap

A python wrapper that connects to multiple 3rd party resources for AWS.

Python Tests Publish PyPi Package

Google Analytics

The GoogleAnalyticsTap connects to the v4 GA api and returns data from Google Analytics.

batch_dates: 'bool. enables batching of queries by date'
start_date: 'str. "yesterday", "today",  "3_days_ago" or "2020-01-01" etc...'
end_date: 'str. "yesterday", "today",  "3_days_ago" or "2020-01-01" etc...'
metrics:
  - expression: 'str. metric name'
dimensions:
  - name: 'str. dimension name'
pageSize: 'int. page size, defaults to 1000'
view_ids:
  - 'str. a list of view to iterate over'
from datetime import datetime

import pandas as pd

from data_tap.google_tap.google_analytics import GoogleAnalyticsTap

ga_tap = GoogleAnalyticsTap(
    config_file='',
    creds_file='',
    auth_method='',
    service_account_email=''
)

dfA = pd.DataFrame()
for report in ga_tap.run_query():
    dfB = pd.DataFrame(report)
    dfA = dfA.append(dfB, ignore_index=True)

dfA.to_json(f"{datetime.utcnow()}.json")

Google Search Console

The GoogleSearchConsoleTap connects to the v3 GSC api and returns data from Google Search Console. Functionality to generate an authentication token is available.

batch_dates: 'bool. enables batching of queries by date'
start_date: 'str. "yesterday", "today",  "3_days_ago" or "2020-01-01" etc...'
end_date: 'str. "yesterday", "today",  "3_days_ago" or "2020-01-01" etc...'
dimensions:
  - 'str. dimension name'
metrics:
  - 'str. metric name'
search_types:
  - 'str. available gsc search types'
site_urls:
  - 'str. website urls in question'
row_limit: 'int. max row limit is 25000'
from datetime import datetime

import pandas as pd

from data_tap.google_tap.google_seach_console import GoogleSeachConsoleTap

gsc_tap = GoogleSeachConsoleTap(
    config_file='',
    creds_file='.pickle'
)

dfA = pd.DataFrame()
for report in gsc_tap.run_query():
    dfB = pd.DataFrame(report)
    dfA = dfA.append(dfB, ignore_index=True)

dfA.to_json(f"{datetime.utcnow()}.json")

Project details


Download files

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

Source Distribution

data_tap-0.0.7.tar.gz (9.3 kB view details)

Uploaded Source

File details

Details for the file data_tap-0.0.7.tar.gz.

File metadata

  • Download URL: data_tap-0.0.7.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for data_tap-0.0.7.tar.gz
Algorithm Hash digest
SHA256 ec32a33f1c319df39d942c831fd0c7b06427ad22e65d9fc6fcdcf45862243a8b
MD5 7d874c62015a207f5b636511bfd0fe59
BLAKE2b-256 59e03cedd121a34df27b60468ed293885e78cdc4db2f44c9d6a6d964d93db8d0

See more details on using hashes here.

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