title: Generate headers in Twisted client
body: <p>i'm using the Twisted web "HTTPClient" protocol to dialogue with a http server (using twisted app as a client), the problem is that most of my request do not accept my header. Is there some sort of way (maybe using certain libraries) to generate header??
  I'll post some code so you can have a look</p>
  
  <pre><code>class Local(HTTPClient):
  def generateHeaders(self, type=None):
      self.sendHeader('User-Agent', 'Twisted Web Client')
      if type:
          self.sendHeader('Content-Type', 'x-www-form-urlencoded')
      self.sendHeader('Accept', '*/*')
      self.sendHeader('Host', 'localhost')
      self.endHeaders()
  
  def connectionMade(self):
      ## GENERATE ID
      self.userid= self.generateID()
      self.sendCommand('POST', '/chat/action=join&amp;user=pirosb3')
      self.generateHeaders(type=True)
  
  def dataReceived(self, data):
      print data
  </code></pre>
  
  <p>As you can see, i created a method that generates header for me, but not very efficient i must say, i always get error responses.</p>
  
  <p>Anyone know a solution?</p>
  
  <p>Thanks</p>