Skip to content

Instantly share code, notes, and snippets.

@colemanja91
Created November 18, 2017 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colemanja91/8dbebf8b51ffa8fe56df7c79ab57b5a8 to your computer and use it in GitHub Desktop.
Save colemanja91/8dbebf8b51ffa8fe56df7c79ab57b5a8 to your computer and use it in GitHub Desktop.
Example showing Eloqua activity exports with PyEloqua
""" export clickthrough data - example """
from json import dump
from pyeloqua import Bulk
bulk = Bulk(username='xxx', password='xxx', company='xxx')
bulk.exports('activities', act_type='EmailClickthrough')
bulk.add_fields() # this will add all fields, or you can specify as listed in the documentation
# Field lists located here: https://github.com/colemanja91/pyeloqua/blob/master/pyeloqua/system_fields.py
bulk.filter_date('ActivityDate', start='2017-03-20 00:00:00', end='2017-03-21 00:00:00')
# Set a filter by activity type; no need to do this if using PyEloqua >= v0.5.5
# bulk.filter_equal('ActivityType', 'EmailClickthrough')
bulk.create_def('my export')
bulk.sync()
activities = bulk.get_export_data()
# export the data to a flatfile
with open('email_click_export.json', 'w') as fopen:
dump(activities, fopen)
@coreyjuliandavis
Copy link

coreyjuliandavis commented Feb 11, 2019

Does bulk.exports have the ability to handle multiple activity types? Or they need to be passed separately? (I.E. - Email Clickthrough, Email Open, etc.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment