Skip to content

Instantly share code, notes, and snippets.

@nferrari
Created November 19, 2012 13:58
Show Gist options
  • Save nferrari/4110781 to your computer and use it in GitHub Desktop.
Save nferrari/4110781 to your computer and use it in GitHub Desktop.
PATCH a mailbox through alwaysdata API
import json
import requests
API_URL = 'https://api.alwaysdata.com/v1/'
API_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
ACCOUNT_NAME = 'account_name'
# Updating a mailbox
mailbox_id = 12345
mailbox_url = '%smailbox/%d/' % (API_URL, mailbox_id)
data = {'sieve_filter': 'my new sieve filter',}
response = requests.patch(mailbox_url, auth=('/%s' % ACCOUNT_NAME, API_KEY), data=json.dumps(data))
print response.status_code
@nferrari
Copy link
Author

Good output (status code) should be 2xx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment