
Product
Secure Your AI-Generated Code with Socket MCP
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
A simple Google Analytics API data extraction.
pip install freesixty
To set up access to your Google Analytics follow first step of these instructions.
Store them in your local machine and enter their path into KEY_FILE_LOCATION
variable.
import freesixty
KEY_FILE_LOCATION = './client_secrets.json'
VIEW_ID = 'XXXXXXX'
query = {
'reportRequests': [
{
'viewId': VIEW_ID,
'dateRanges': [{'startDate': '2009-01-01', 'endDate': '2019-01-05'}],
'metrics': [{'expression': 'ga:sessions'}],
'dimensions': [{'name': 'ga:country', 'name': 'ga:date'}]
}]
}
analytics = freesixty.initialize_analyticsreporting(KEY_FILE_LOCATION)
result, is_data_golden = freesixty.execute_query(analytics, query)
On the other hand if we want to store resulting data to a desired URI.
import freesixty
KEY_FILE_LOCATION = './client_secrets.json'
VIEW_ID = 'XXXXXXX'
folder_uri = 'file:///tmp/example/folder'
query = {
'reportRequests': [
{
'viewId': VIEW_ID,
'dateRanges': [{'startDate': '2009-01-01', 'endDate': '2019-01-05'}],
'metrics': [{'expression': 'ga:sessions'}],
'dimensions': [{'name': 'ga:country', 'name': 'ga:date'}]
}]
}
analytics = freesixty.initialize_analyticsreporting(KEY_FILE_LOCATION)
freesixty.store_query(analytics, query, folder_uri)
In case a query would return over 100k rows of data it will fail. We can get around it by splitting the date range into smaller chunks:
queries = freesixty.split_query(query=query, start_date='2019-01-01', end_date='2019-02-01', freq='D')
for query in queries:
freesixty.store_query(analytics, query, folder_uri)
:cake:
FAQs
Simple Google Analytics API data extraction.
We found that freesixty demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
Security News
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
Research
Security News
Socket’s Threat Research Team has uncovered 60 npm packages using post-install scripts to silently exfiltrate hostnames, IP addresses, DNS servers, and user directories to a Discord-controlled endpoint.