Created
September 18, 2014 22:30
-
-
Save dpawluk/bd08d9b447eedff52dff to your computer and use it in GitHub Desktop.
uploads recipient addresses from csv
This file contains hidden or 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
| import requests | |
| import pandas as pd | |
| s = requests.Session() | |
| s.headers.update({'Content-Type': 'application/json'}) | |
| s.auth = ('USERNAME/token','TOKEN') | |
| df = pd.read_csv('./support_addy.csv') | |
| for count, row in df.iterrows(): | |
| name = row[0] | |
| address = row[1] | |
| payload = '{"recipient_address": {"name":"' + str(name)+'", "email": "'+str(address)+'", "default": false }}' | |
| r = s.post("https://SUBDOMAIN.zendesk.com/api/v2/recipient_addresses.json", data=payload) | |
| print "Request completed with response " + str(r.status_code) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment