Python __getprop__ fails
I've added the "requests" package to the ...\TestComplete 12\x64\Bin\Extensions\Python\Python36\Lib folder.
This code works beautifully to return the proper response using the Python installed by TestComplete (Python 3.6 with TestComplete 12.42):
import requests
baseURL = 'https://jira.mycompany.com'
URL = baseURL + '/rest/zapi/latest/util/project-list'
r = requests.get(URL, auth=('MyUsername', 'MyPassword'), verify="c:\shared\certs")
print (r.text)
This code does not work from within a Python project in TestComplete (running the x64 copy):
import requests
def TestAPICall():
baseURL = 'https://jira.mycompany.com'
URL = baseURL + '/rest/zapi/latest/util/project-list'
r = requests.__getprop__('get', URL, auth=('MyUsername', 'MyPassword'), verify="c:\shared\certs")
Log.Message(r.text)
The latter returns a Python runtime error:
AttributeError: module 'requests' has no attribute '__getprop__'
I've also tried:
r = requests.get(URL, auth=('MyUsername', 'MyPassword'), verify="c:\shared\certs")
which returns:
AttributeError: module 'requests' has no attribute 'get'
What am I missing?
Thanks,
Heath
An alternative... rather than going third party, have you looked into using TestComplete's own aqHTTP object for sending Get and Post requests?
https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqhttp/index.html