Forum Discussion

Kate's avatar
Kate
Contributor
8 years ago
Solved

Empty response (request in python)

I need to retrieve some data using GET request.

Here is a part of my code:

my_conn = http.client.HTTPConnection("mydomain.com")
my_conn.request('GET', '/blahblahblah/.....server_type=35') 
  response = my_conn.getresponse()
  if response.status != 200:
    Log.Error('Did not get info')
  else:
    Log.Message(response.read())

I run the same piece of code twice - for server type 35 and for server type 36.
If I run that code in Sublime3 - I get all the data printed out for both server types.

But in TestComplete I got an empty response for both of them.

I added .decode('UTF-8') to response.read()

It helped for one request, but did not help for the second one. It is still empty...

 

Any suggestions?