Skip to content

Instantly share code, notes, and snippets.

@linkerzx
Last active October 11, 2018 20:00
Show Gist options
  • Save linkerzx/24a8e565d2da4e2285cbde3e70725405 to your computer and use it in GitHub Desktop.
Save linkerzx/24a8e565d2da4e2285cbde3e70725405 to your computer and use it in GitHub Desktop.
def post_to_data_extension(
accessToken: str,
dataExtensionKey: str,
items: list
) -> requests.Response:
host = "https://www.exacttargetapis.com"
end_point = "/hub/v1/dataevents/key:{key}/rowset"
url = host + end_point.format(key=dataExtensionKey)
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer %s" % accessToken
}
data = items
req = requests.post(
url,
headers=headers,
data=json.dumps(data)
)
return req
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment