Generated on 25 November 2024
from pydo version v0.6.0
Description
To add a new SSH public key to your DigitalOcean account, send a POST request to /v2/account/keys. Set the name attribute to the name you wish to use and the public_key attribute to the full public key you are adding.
Request Sample
importosfrompydoimportClientclient=Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))req={"public_key":"ssh-rsa AEXAMPLEaC1yc2EAAAADAQABAAAAQQDDHr/jh2Jy4yALcK4JyWbVkPRaWmhck3IgCoeOO3z1e2dBowLh64QAM+Qb72pxekALga2oi4GvT+TlWNhzPH4V example","name":"My SSH Public Key"}resp=client.ssh_keys.create(body=req)