Skip to content
This repository was archived by the owner on Oct 29, 2021. It is now read-only.

Accept integers and other types as call arguments #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

meisterluk
Copy link

Assume the following command:

  doctl compute droplet neighbors 42 --output json

Because in a CLI, everything is considered as a string, this call is just fine.
However, assume the following call in doctl:

  doctl.compute.droplet.neighbors(42)

This one will fail with the following error:

Traceback (most recent call last):
  File "main.py", line 114, in upgrade
    print(doctl.compute.droplet.neighbors(droplet['id']))
  File "/home/user/venv/lib/python3.6/site-packages/doctl.py", line 224, in neighbors
    return self.do.doctl("compute", "droplet", "neighbors", droplet_id)
  File "/home/user/venv/lib/python3.6/site-packages/doctl.py", line 82, in doctl
    args = " ".join(args)
TypeError: sequence item 3: expected str instance, int found

Apparently, 42 must be a string in order to work out. str(42) seems non-intuitive and therefore I propose this change.

Assume the following command:

```
  doctl compute droplet neighbors 42 --output json
```

Because in a CLI, everything is considered as a string, this call is just fine.
However, assume the following call in doctl:

```
  doctl.compute.droplet.neighbors(42)
```

This one will fail with the following error:

```
Traceback (most recent call last):
  File "main.py", line 114, in upgrade
    print(doctl.compute.droplet.neighbors(droplet['id']))
  File "/home/user/venv/lib/python3.6/site-packages/doctl.py", line 224, in neighbors
    return self.do.doctl("compute", "droplet", "neighbors", droplet_id)
  File "/home/user/venv/lib/python3.6/site-packages/doctl.py", line 82, in doctl
    args = " ".join(args)
TypeError: sequence item 3: expected str instance, int found
```

Apparently, 42 must be a string in order to work out. `str(42)` seems non-intuitive and therefore I propose this change.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant