Search This Blog

Tuesday, November 13, 2018

Example to call digitalocean api from python


'''
Created on Mar 6, 2015

@author: it.i88.ca

Example to call digitalocean api from python
'''
import urllib2
import urllib
data = {}
data['client_id'] = '8888'
data['api_key'] = '8888'
url_values = urllib.urlencode(data)
url = 'https://api.digitalocean.com/droplets/8888/reboot'
full_url = url + '?' + url_values
data=urllib2.urlopen(full_url)
response=data.read()
print response