I am not maintaing this repo anymore, for the latest library please head to https://github.com/jepcastelein/marketo-rest-python
Python interface to marketo REST api
Detailed Doc - http://developers.marketo.com/documentation/rest/
pip install pythonmarketo
from pythonmarketo.client import MarketoClient
mc = MarketoClient(host = <Host>,
client_id = <Client_Id>,
client_secret = <Client_Secret>)
API Ref: http://developers.marketo.com/documentation/rest/get-multiple-leads-by-filter-type/
#values could be either "v1 v2 v3" or [v1,v2,v3]
mc.execute(method = 'get_leads', filtr = 'email', values = 'test@test.com', fields=['email','firstName','lastName','company','postalCode'])
API Ref: http://developers.marketo.com/documentation/rest/get-multiple-leads-by-list-id/
mc.execute(method = 'get_leads_by_listId', listId = '676', fields=['email','firstName','lastName','company','postalCode'])
API Ref: http://developers.marketo.com/documentation/rest/get-activity-types/
mc.execute(method = 'get_activity_types')
API Ref: http://developers.marketo.com/documentation/rest/get-paging-token/
#sinceDatetime format:
#2014-10-06T13:22:17-08:00
#2014-10-06T13:22-07:00
#2014-10-06
mc.execute(method = 'get_paging_token', sinceDatetime = '2014-10-06')
API Ref: http://developers.marketo.com/documentation/rest/get-lead-activities/
#activityTypeIds could be either "v1 v2 v3" or [v1,v2,v3]
mc.execute(method = 'get_lead_activity', activityTypeIds = ['23','22'], sinceDatetime = '2014-10-06', batchSize = None, listId = None)
API Ref: http://developers.marketo.com/documentation/rest/createupdate-leads/
mc.execute(method = 'create_lead', lookupField = 'email', lookupValue = 'test@test.com', values = {'firstName':'Test1', 'lastName':'Test2'})
API Ref: http://developers.marketo.com/documentation/rest/createupdate-leads/
mc.execute(method = 'update_lead', lookupField = 'email', lookupValue = 'test@test.com', values = {'firstName':'Test1', 'lastName':'Test2'})
Remaining API