I am trying to use the API with Conoha, which provides the server, but it has failed.
What I want to do is add servers using API.When I checked it, I think it is made according to the procedure below.
1.Issuing tokens https://www.conoha.jp/docs/identity-post_tokens.html
2. Add VM https://www.conoha.jp/docs/compute-create_vm.html
Could you please point out the mistake as I received a 404 bad request error when I gave the parameters from site 1 to the request?This is my first time using the API, so something basic might be wrong.There is no problem with endpoints.
import requests
import json
defmain()->None:
url='https://identity.tyo1.conoha.io/v2.0/tokens '
data={ "username": "aaa", "password": "bbb", "tenantId": "ccc"}
res=requests.post(url=url,params=data)
print(res.status_code)
print(res.json())
if name=='main':
main()
https://www.conoha.jp/docs/identity-post_tokens.html has
It is written to send a Json format string (for example, '{"auth":{"passwordCredentials":{"username":"ConoHa", "password":"paSSword123456#$%", "tenantId":"487727e3921d44e3bfe7ebbbbf085e"}}}' as data.
The code in the question is trying to send an associative array ("username": "aaa", "password": "bbb", "tenantId": "ccc"}.
This is probably part of the reason for the bad request error.
567 Who developed the "avformat-59.dll" that comes with FFmpeg?
566 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
595 GDB gets version error when attempting to debug with the Presense SDK (IDE)
598 Uncaught (inpromise) Error on Electron: An object could not be cloned
877 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.