I have a function that updates a record via an API. The API accepts a variety of optional keyword parameters:
def update_by_email(self, email=None, **kwargs):
result = post(path='/do/update/email/{email}'.format(email=email), params=kwargs)
I have another function that uses the first function to update an individual field in the record:
def update_field(email=None, field=None, field_value=None):
"""Encoded parameter should be formatted as <field>=<field_value>"""
request = update_by_email(email=email, field=field_value)
This doesn't work. When I call:
update_field(email='[email protected]', field='name', field_value='joe')
the url is encoded as:
https://www.example.com/api/do/update/email/[email protected]?field=Joe
How can I get it to encode as:
https://www.example.com/api/do/update/email/[email protected]?name=Joe
Thank you in advance.