Trying to use API via Python, getting blank result
Posted: Mon Apr 16, 2018 10:16 pm
Ok, so I have tried this many ways, via URL directly, using username and password or API hash, and every time I try, I get a blank result.
Here is the latest attempt to get it to work:
I have tried it other ways and gotten nothing in return. Do you have to enable API? Is there a log I can check to see what error there was if there is one? (normally it is displayed on the screen, but nothing is in this case)
Here is the latest attempt to get it to work:
Code: Select all
import urllib2
import json
import os
vst_url = "https://myserver.com:8083/api/"
vst_hash = "my_really_long_hash_api_key"
vst_cmd = "v-list-users"
request = urllib2.Request(vst_url, headers={"hash":vst_hash, "cmd":vst_cmd, "returncode":"yes", "arg1":"json"})
result = json.load(urllib2.urlopen(request))
print result