Ask a Question

Python __getprop__ fails

SOLVED
hhowe
Occasional Contributor

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

10 REPLIES 10
hhowe
Occasional Contributor

Thanks, Robert. That is a beautiful option for the matter I reported, along with great sample code. Now I'm trying to wrap my head around how to specify a certificate for that REST call (the "verify" as shown in my original Python sample). I'm assuming it can be done with a header, but can't quite get there. Any thought? 🙂

cancel
Showing results for 
Search instead for 
Did you mean: