Skip to content

Instantly share code, notes, and snippets.

@blackknight36
Created April 22, 2016 13:48
Show Gist options
  • Save blackknight36/b14a66229a42a1bde61c6710e05f5b96 to your computer and use it in GitHub Desktop.
Save blackknight36/b14a66229a42a1bde61c6710e05f5b96 to your computer and use it in GitHub Desktop.
List ssh keys on a DO account
#!/usr/bin/env python
import requests
import json
apikey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
headers = { "Authorization": "Bearer "+ apikey , "Content-Type" : "application/json" }
r = requests.get('https://api.digitalocean.com/v2/account/keys', headers=headers)
parsed = json.loads(r.text)
print json.dumps(parsed, indent=4, sort_keys=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment