Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
HTTP Class Reference
Inheritance diagram for HTTP:
HTTPS

Public Member Functions

def __init__
 
def connect
 
def getfile
 
def putheader
 
def getreply
 
def close
 

Data Fields

 send
 
 putrequest
 
 endheaders
 
 set_debuglevel
 
 file
 hmm. More...
 
 headers
 

Static Public Attributes

int debuglevel = 0
 

Detailed Description

Definition at line 692 of file httplib.py.

Constructor & Destructor Documentation

def __init__ (   self,
  host = '',
  port = None 
)

Definition at line 702 of file httplib.py.

703  def __init__(self, host='', port=None):
704  "Provide a default host, since the superclass requires one."
705 
706  # some joker passed 0 explicitly, meaning default port
707  if port == 0:
708  port = None
709 
710  # Note that we may pass an empty string as the host; this will throw
711  # an error when we attempt to connect. Presumably, the client code
712  # will call connect before then, with a proper host.
713  self._setup(self._connection_class(host, port))

Member Function Documentation

def close (   self)

Definition at line 771 of file httplib.py.

772  def close(self):
773  self._conn.close()
774 
775  # note that self.file == response.fp, which gets closed by the
776  # superclass. just clear the object ref here.
777  ### hmm. messy. if status==-1, then self.file is owned by us.
778  ### well... we aren't explicitly closing, but losing this ref will
779  ### do it
780  self.file = None
def connect (   self,
  host = None,
  port = None 
)

Definition at line 728 of file httplib.py.

729  def connect(self, host=None, port=None):
730  "Accept arguments to set the host/port, since the superclass doesn't."
731 
732  if host is not None:
733  self._conn._set_hostport(host, port)
734  self._conn.connect()
def getfile (   self)

Definition at line 735 of file httplib.py.

736  def getfile(self):
737  "Provide a getfile, since the superclass' does not use this concept."
738  return self.file
def getreply (   self)
Compat definition since superclass does not define it.

Returns a tuple consisting of:
- server status code (e.g. '200' if all goes well)
- server "reason" corresponding to status code
- any RFC822 headers in the response from the server

Definition at line 743 of file httplib.py.

744  def getreply(self):
745  """Compat definition since superclass does not define it.
746 
747  Returns a tuple consisting of:
748  - server status code (e.g. '200' if all goes well)
749  - server "reason" corresponding to status code
750  - any RFC822 headers in the response from the server
751  """
752  try:
753  response = self._conn.getresponse()
754  except BadStatusLine, e:
755  ### hmm. if getresponse() ever closes the socket on a bad request,
756  ### then we are going to have problems with self.sock
757 
758  ### should we keep this behavior? do people use it?
759  # keep the socket open (as a file), and return it
760  self.file = self._conn.sock.makefile('rb', 0)
761 
762  # close our socket -- we want to restart after any protocol error
763  self.close()
765  self.headers = None
766  return -1, e.line, None
767 
768  self.headers = response.msg
769  self.file = response.fp
770  return response.status, response.reason, response.msg
def putheader (   self,
  header,
  values 
)

Definition at line 739 of file httplib.py.

740  def putheader(self, header, *values):
741  "The superclass allows only one value argument."
742  self._conn.putheader(header, '\r\n\t'.join(values))

Field Documentation

int debuglevel = 0
static

Definition at line 698 of file httplib.py.

endheaders

Definition at line 720 of file httplib.py.

file

hmm.

if getresponse() ever closes the socket on a bad request, then we are going to have problems with self.sock should we keep this behavior? do people use it? keep the socket open (as a file), and return it

messy. if status==-1, then self.file is owned by us. well... we aren't explicitly closing, but losing this ref will do it

Definition at line 726 of file httplib.py.

headers

Definition at line 764 of file httplib.py.

putrequest

Definition at line 719 of file httplib.py.

send

Definition at line 718 of file httplib.py.

set_debuglevel

Definition at line 721 of file httplib.py.


The documentation for this class was generated from the following file: