Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

Commit

Permalink
Adding code for retrieve_lead to follow api
Browse files Browse the repository at this point in the history
  • Loading branch information
recomputing committed Dec 28, 2011
1 parent 7a23932 commit 0787274
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions hapi/leads.py
Expand Up @@ -104,13 +104,18 @@ def get_leads(self, *guids, **options):
return leads

def retrieve_lead(self, *guid, **options):
"""path could be
https://hubapi.com/leads/v1/lead/(GUID)?hapikey=(your_API_KEY)
https://hubapi.com/leads/v1/lead?hapikey=(your_API_KEY)&conversionEventGuid=(event_guid)
https://hubapi.com/leads/v1/lead?hapikey=(your_API_KEY)&userToken=(user_token)
"""

return self._call('lead/%s' % guid, **options)
cur_guid = guid or ''
params = {}
for key in options:
params[key] = options[key]
""" Set guid to -1 as default for not finding a user """
lead = {'guid' : '-1'}
""" wrap lead call so that it doesn't error out when not finding a lead """
try:
lead = self._call('lead/%s' % cur_guid, params, **options)
except:
""" no lead here """
return lead


def update_lead(self, guid, update_data=None, **options):
Expand Down

0 comments on commit 0787274

Please sign in to comment.