0

Possible Duplicate:
Why am I getting this error in python ? (httplib)

i have some problem with coding in python, i want to create web service with abyssws python in local python service, but i cannot receive response..whereas i get response when i request from browser..

my code like this :

import httplib
IP = "local ip"
v_params = ""
conn = httplib.HTTPConnection(IP,8021)
conn.request("GET", v_params)
response = conn.getresponse() 
data_response = response.read()

and getting error ilke this

Traceback(most recent call last):
File "C:\Python24\lib\httplib.py", line 866, in getresponse
   response.begin()
File "C:\Python24\lib\httplib.py", line 336, in begin
 version, status, reason = self._read_status()
File "C:\Python24\lib\httplib.py", line 300, in _read_status
 raise BadStatusLine(line)
httplib.BadStatusLine

any suggestion??please help me?

Community
  • 1
  • 1

1 Answers1

0

The server you connected to did not send a proper HTTP response line. Such a response should consist of a number followed by a human-readable textual description, like:

200 Ok

or

404 Not Found

You need to verify what the server on port 8021 sends. Try using telnet IP 8021 from the terminal, then entering something like GET / HTTP/1.1 plus two newlines to see what is returned by the server.

I note that your v_params string is empty; it may be your server expects at least the empty path (/). However, not sending a properly formatted error code in that case is still a violation of the HTTP standard.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343