Last active
October 11, 2018 20:00
-
-
Save linkerzx/24a8e565d2da4e2285cbde3e70725405 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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