koalalorenzo/python-digitalocean

SSH Keys API mistake

Closed this issue · 4 comments

Can you write a little bit more about the mistake? Do you have an error or problem?

pahaz commented

Sorry. Example:

k = SSHKey(fingerprint=SSHKEY, token=TOKEN)
k.load()

it raise error:

  File "./do-test.py", line 75, in <module>
    k.load()
  File "/Users/pahaz/PycharmProjects/proctoring-project/__data__/venv/lib/python3.5/site-packages/digitalocean/SSHKey.py", line 38, in load
    ssh_key = data['ssh_key']
KeyError: 'ssh_key'

I was wrong. Problem in https://github.com/pahaz/python-digitalocean/blob/e2bb8e9fd04a9aea0ea16ba3aff4ca68c0a71a9d/digitalocean/SSHKey.py#L30 and https://github.com/pahaz/python-digitalocean/blob/e2bb8e9fd04a9aea0ea16ba3aff4ca68c0a71a9d/digitalocean/SSHKey.py#L7

As you can see self.id='' and identifier=''.

Fix:
https://github.com/pahaz/python-digitalocean/blob/e2bb8e9fd04a9aea0ea16ba3aff4ca68c0a71a9d/digitalocean/SSHKey.py#L30

change this line to:

if self.id:

Ok. I will update it for the next release. (Monday-ish?)

Fixed in the last merge. Release soon!
Please comment/reopen if the change is not working 👍