Skip to content

Instantly share code, notes, and snippets.

Diogo Santos diogo22santos

View GitHub Profile
import pandas_redshift as pr
pr.connect_to_redshift(dbname = 'YOU_DATABASE', host = 'YOUR_HOST', port = 'YOUR_PORT',
user = 'YOUR_USER', password = 'YOUR PASSWORD')
pr.connect_to_s3(aws_access_key_id = 'YOUR_ACCESS_KEY_ID', aws_secret_access_key = 'YOUR_aCCESS_KEY',
bucket = 'BUCKET_TO_LOAD')
pr.pandas_to_redshift(data_frame = 'DATA_FRAME_TO_LOAD', redshift_table_name = 'TABLE_IN_REDSHIFT_TO_LOAD')
fields = 'members.client,members.last_changed,members.list_id,members.rating,members.email_address,members.merge_fields.uuid,members.stats,members.status,members.member_rating,members.timestamp_opt'
client.lists.members.all(list_id = '29hfkl23' , count = 20, offset = 0 , fields = fields)['members']
diogo22santos / retrive
Created Dec 6, 2018
retrive lists from mailshimp
View retrive
lists = client.lists.all(get_all=True, fields=",")['lists']
#get_all intends to provide you with all the available lists
#fields are the collumns you want to extract
diogo22santos / import
Last active Dec 6, 2018
From Mailshimp 3 API to AWS Redshift & S3 with Python
View import
from mailchimp3 import MailChimp
import pandas as pd
client = MailChimp(mc_api='YOUR_API_KEY', mc_user='YOUR_USERNAME')
You can’t perform that action at this time.