def test_get_lead_wrap(self): self.assertEqual(get_lead.wrap("email", "*****@*****.**"), u"<ns1:paramsGetLead>" u"<leadKey>" u"<keyType>EMAIL</keyType>" u"<keyValue>[email protected]</keyValue>" u"</leadKey>" u"</ns1:paramsGetLead>") self.assertEqual(get_lead.wrap("cookie", "561-HYG-937&token:_mch-marketo.com-1258067434006-50277"), u"<ns1:paramsGetLead>" u"<leadKey>" u"<keyType>COOKIE</keyType>" u"<keyValue>561-HYG-937&token:_mch-marketo.com-1258067434006-50277</keyValue>" u"</leadKey>" u"</ns1:paramsGetLead>")
def test_get_lead_wrap(self): self.assertEqual( get_lead.wrap("email", "*****@*****.**"), u"<ns1:paramsGetLead>" u"<leadKey>" u"<keyType>EMAIL</keyType>" u"<keyValue>[email protected]</keyValue>" u"</leadKey>" u"</ns1:paramsGetLead>") self.assertEqual( get_lead.wrap( "cookie", "561-HYG-937&token:_mch-marketo.com-1258067434006-50277"), u"<ns1:paramsGetLead>" u"<leadKey>" u"<keyType>COOKIE</keyType>" u"<keyValue>561-HYG-937&token:_mch-marketo.com-1258067434006-50277</keyValue>" u"</leadKey>" u"</ns1:paramsGetLead>")
def get_lead(self, email=None): if not email or not isinstance(email, str): raise ValueError('Must supply an email as a non empty string.') body = get_lead.wrap(email) response = self.request(body) if response.status_code == 200: return get_lead.unwrap(response) else: raise Exception(response.text)
def get_lead(self, email=None): if not email or not isinstance(email, (str, unicode)): raise ValueError('Must supply an email as a non empty string.') body = get_lead.wrap(email) response = self.request(body) if response.status_code == 200: return get_lead.unwrap(response) else: raise Exception(response.text)
def get_lead(self, idnum=None, cookie=None, email=None, sfdcleadid=None, leadowneremail=None, sfdcaccountid=None, sfdccontactid=None, sfdcleadownerid=None, sfdcopptyid=None, **kwargs): """ This function retrieves a single lead record from Marketo. If the lead exists based on the input parameters, the lead record attributes will be returned in the result. http://developers.marketo.com/documentation/soap/getlead/ :param idnum: The Marketo ID :param cookie: The value generated by the Munchkin Javascript :param email: The email address associated with the lead :param sfdcleadid: The lead ID from SalesForce :param leadowneremail: The Lead Owner Email :param sfdcaccountid: The Account ID from SalesForce :param sfdccontactid: The Contact ID from SalesForce :param sfdcleadownerid: The Lead owner ID from SalesForce :param sfdcopptyid: The Opportunity ID from SalesForce :param kwargs: For other keytypes in the future... :return: :raise exceptions.unwrap: """ # collect all keyword arguments key_types = locals().copy() del key_types["self"] del key_types["kwargs"] key_types.update(kwargs) for each in key_types.keys(): if not key_types[each]: del key_types[each] if len(key_types) != 1: raise exceptions.MktException( "get_leads() takes exactly 1 keyword argument (%d given)" % len(key_types)) body = get_lead.wrap(*(key_types.items()[0])) response = self.request(body) if response.status_code == 200: return get_lead.unwrap(response.text.encode("utf-8")) else: raise exceptions.unwrap(response.text)
def get_lead(self, email=None, key_value=None, key_type='EMAIL'): if email: key_value = email key_type = 'EMAIL' if not key_value or not isinstance(key_value, (str, unicode)): raise ValueError('Must supply a key_value(i.e. email) as a non empty string.') body = get_lead.wrap(key_value=key_value, key_type=key_type) response = self.request(body) # print response.text if response.status_code == 200: return get_lead.unwrap(response) else: raise Exception(response.text)
def get_lead(self, idnum=None, cookie=None, email=None, sfdcleadid=None, leadowneremail=None, sfdcaccountid=None, sfdccontactid=None, sfdcleadownerid=None, sfdcopptyid=None, **kwargs): """ This function retrieves a single lead record from Marketo. If the lead exists based on the input parameters, the lead record attributes will be returned in the result. http://developers.marketo.com/documentation/soap/getlead/ :param idnum: The Marketo ID :param cookie: The value generated by the Munchkin Javascript :param email: The email address associated with the lead :param sfdcleadid: The lead ID from SalesForce :param leadowneremail: The Lead Owner Email :param sfdcaccountid: The Account ID from SalesForce :param sfdccontactid: The Contact ID from SalesForce :param sfdcleadownerid: The Lead owner ID from SalesForce :param sfdcopptyid: The Opportunity ID from SalesForce :param kwargs: For other keytypes in the future... :return: :raise exceptions.unwrap: """ # collect all keyword arguments key_types = locals().copy() del key_types["self"] del key_types["kwargs"] key_types.update(kwargs) for each in key_types.keys(): if not key_types[each]: del key_types[each] if len(key_types) != 1: raise exceptions.MktException("get_leads() takes exactly 1 keyword argument (%d given)" % len(key_types)) body = get_lead.wrap(*(key_types.items()[0])) response = self.request(body) if response.status_code == 200: return get_lead.unwrap(response.text.encode("utf-8")) else: raise exceptions.unwrap(response.text)