Created
May 27, 2014 16:34
-
-
Save aliafshar/aa6825f6ebaa52bc1179 to your computer and use it in GitHub Desktop.
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
| from apiclient import errors | |
| # ... | |
| # XXX Auth | |
| # XXX Build a service | |
| ## | |
| # Addition of records | |
| # | |
| BODY = { | |
| 'additions' : [{ | |
| 'name' : 'example.com.', | |
| 'type' : 'A', | |
| 'ttl' : '3600', | |
| 'rrdatas' : [ | |
| '1.2.3.4' | |
| ] | |
| }] | |
| } | |
| try: | |
| response = service.changes().create(project=PROJECT_NAME, | |
| managedZone=ZONE_NAME, | |
| body=BODY).execute() | |
| except errors.HttpError, error: | |
| print 'An error occurred: %s' % error | |
| ## | |
| # Deletion and addition of records in the same request: | |
| # | |
| BODY = { | |
| 'additions' : [{ | |
| 'name' : 'example.com.', | |
| 'type' : 'A', | |
| 'ttl' : '3600', | |
| 'rrdatas' : [ | |
| '2.3.4.5' | |
| ] | |
| }], | |
| 'deletions' : [{ | |
| 'name' : 'example.com.', | |
| 'type' : 'A', | |
| 'ttl' : '3600', | |
| 'rrdatas' : [ | |
| '1.2.3.4' | |
| ] | |
| }] | |
| } | |
| try: | |
| response = service.changes().create(project=PROJECT_NAME, | |
| managedZone=ZONE_NAME, | |
| body=BODY).execute() | |
| except errors.HttpError, error: | |
| print 'An error occurred: %s' % error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment