~moovida-developers/moovida/account_video_intro

« back to all changes in this revision

Viewing changes to elisa-plugins/elisa/plugins/http_client/http_client.py

  • Committer: Philippe Normand
  • Date: 2009-08-18 14:02:23 UTC
  • mfrom: (1466.5.7 moovida_http_auth)
  • Revision ID: philippe@fluendo.com-20090818140223-0ylij32hufci9lph
http_client: basic authentication support

Show diffs side-by-side

added added

removed removed

Lines of Context:
228
228
            self._connector = reactor.connectTCP(self._host, self._port,
229
229
                                                 factory)
230
230
 
231
 
    def request(self, uri, method='GET'):
 
231
    def request(self, uri, method='GET', headers={}, stream=None):
232
232
        """
233
233
        Send an HTTP request.
234
234
 
236
236
        @type uri:     C{str}
237
237
        @param method: the HTTP method of the request (default: GET)
238
238
        @type method:  C{str}
 
239
        @param headers: optional headers to send to the server or C{{}}
 
240
                        (the default)
 
241
        @type headers: C{dict} or L{twisted.web2.http_headers.Headers}
 
242
        @param stream: optional content body to send to the server
 
243
        @type stream:  L{twisted.web2.stream.IByteStream}
239
244
 
240
245
        @return:       a deferred triggered when the request is executed
241
246
        @rtype:        L{elisa.core.utils.cancellable_defer.CancellableDeferred}
242
247
        """
243
 
        return self.request_full(ClientRequest(method, uri, {}, None))
 
248
        return self.request_full(ClientRequest(method, uri, headers, stream))
244
249
 
245
250
    def request_full(self, request):
246
251
        """