AnsweredAssumed Answered

Calling a RESTful API: python

Question asked by Shouchun (Marnith) Peng Peng on May 10, 2017
Latest reply on May 11, 2017 by Shouchun (Marnith) Peng Peng

Hi DevNet,

 

Now i am able to manual collect the index results from the api page of HCI, but i would like to include that into my python script.

 

do you happen to have a working sample for python requesting rest api? just in case, you have some ideas.

 

this is the input that i can get from the api page

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{

"indexName": "OBSLOG",

"offset": 0,

"itemsToReturn": 100

}' 'https://216.84.238.169:8888/api/search/query'

 

have tried using the request url:

https://216.84.238.169:8888/api/search/query

 

import requests

response = requests.get("https://216.84.238.169:8888/api/search/query")

print(response.status_code)

 

and this hits to another SSL error

SSLError: ("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",)

 

Any suggestions?

 

thanks

Best regards,

Marnith

Outcomes