Created
April 22, 2016 13:48
-
-
Save blackknight36/b14a66229a42a1bde61c6710e05f5b96 to your computer and use it in GitHub Desktop.
List ssh keys on a DO account
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
#!/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