Skip to content

Instantly share code, notes, and snippets.

View ryandhubbard's full-sized avatar

Ryan Hubbard ryandhubbard

  • Planet Art
  • Los Angeles
View GitHub Profile
import gspread
from google.oauth2.service_account import Credentials
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
import os
import pickle
# Define the scope
def fetch_paginated_data(url, params,headers):
all_results = []
response = requests.get(url, headers=headers, params=params)
data = response.json()
# print(data)
all_results.extend(data['interactions'])
# print(all_results)
while 'next' in data['links']:
@ryandhubbard
ryandhubbard / appsflyer_skan_4.0.py
Created November 30, 2023 21:22
AppsFlyer Get Modeled Conversion Value by Campaign and App
import requests
import datetime
import pandas as pd
import time
from io import StringIO
app_ids = []
#set start date to 7 days ago as a date formatted yyyy-mm-dd
start_date = datetime.datetime.today() - datetime.timedelta(days=7)
@ryandhubbard
ryandhubbard / get_gists.py
Created November 30, 2023 21:17 — forked from leoloobeek/get_gists.py
Download all gists for a specific user
# first: mkdir user && cd user && cp /path/to/get_gists.py .
# python3 get_gists.py user
import requests
import sys
from subprocess import call
user = sys.argv[1]
r = requests.get('https://api.github.com/users/{0}/gists'.format(user))
@ryandhubbard
ryandhubbard / broken_links.py
Last active November 11, 2023 06:58
Search Website for broken links
@ryandhubbard
ryandhubbard / upload_sftp_files_to_s3.py
Created October 27, 2023 22:48
This script connects to a sftp server and copies the files to a s3 bucket.
import paramiko
import urllib.parse
import stat
import boto3
# import logging
import os
username = ""
password = ""
hostname = "sftp.domain.com/"
@ryandhubbard
ryandhubbard / app_review_monitor.py
Created October 27, 2023 03:04
This script will automatically scrape app reviews from ios and android app stores. It will email you the results and show any changes within the last 7 days to the top reviews displayed in each app store.
# %%
import requests
from bs4 import BeautifulSoup
import pandas as pd
from IPython.display import HTML
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.application import MIMEApplication
from email.mime.text import MIMEText
import smtplib
@ryandhubbard
ryandhubbard / clean_s3_folder.py
Created October 21, 2023 22:04
Clean up a s3 bucket folder and copy data by date files
import pandas as pd
import boto3
from io import StringIO
import datetime
import warnings
#suppress warnings
warnings.filterwarnings("ignore")
def main():
@ryandhubbard
ryandhubbard / cordial_supplemental_data.py
Created October 10, 2023 21:24
Upload supplemental data to cordial
import json
import boto3
from datetime import datetime, timedelta
import requests
import base64
username = ''
password = ""
# Encode the credentials in base64
@ryandhubbard
ryandhubbard / conversion_funnel_bigquery.sql
Created October 10, 2023 20:39
get yesterdays user counts for conversion funnel steps from big query
SELECT
PARSE_DATE("%Y%m%d", event_date) as date,
geo.country as country,
case
WHEN DATE(TIMESTAMP_MICROS(user_first_touch_timestamp)) = DATE(TIMESTAMP_MICROS(event_timestamp)) THEN 'New Visitor'
ELSE 'Returning Visitor'
END AS user_type,
COALESCE(collected_traffic_source.manual_medium) as medium,
COALESCE(collected_traffic_source.manual_source) as source,
COALESCE(collected_traffic_source.manual_campaign_name) as campaign,