class DummyRequest: (source)
Known subclasses: twisted.web.test.test_web.DummyRequestForLogTest
Represents a dummy or fake request. See twisted.web.server.Request
.
Method | __init__ |
Undocumented |
Method | add |
Undocumented |
Method | finish |
Record that the request is finished and callback and Deferred s waiting for notification of this. |
Method | get |
Return dictionary mapping the names of all received headers to the last value received for each. |
Method | get |
Return the IAddress of the client that made this request. |
Method | get |
Return the IPv4 address of the client which made this request, if there is one, otherwise None . |
Method | get |
Retrieve the value of a request header. |
Method | get |
Get a dummy transport's host. |
Method | get |
Get a dummy hostname associated to the HTTP request. |
Method | get |
Undocumented |
Method | notify |
Return a Deferred which is called back with None when the request is finished. This will probably only work if you haven't called finish yet. |
Method | processing |
Errback and Deferreds waiting for finish notification. |
Method | redirect |
Utility function that does a redirect. |
Method | register |
Call an IPullProducer 's resumeProducing method in a loop until it unregisters itself. |
Method | render |
Render the given resource as a response to this request. |
Method | set |
Undocumented |
Method | set |
TODO: make this assert on write() if the header is content-length |
Method | set |
Change the host and port the request thinks it's using. |
Method | set |
Undocumented |
Method | set |
Set the HTTP status response code, but takes care that this is called before any data is written. |
Method | unregister |
Undocumented |
Method | write |
Undocumented |
Class Variable | client |
Undocumented |
Class Variable | method |
Undocumented |
Class Variable | uri |
Undocumented |
Instance Variable | args |
Undocumented |
Instance Variable | clientproto |
Undocumented |
Instance Variable | finished |
Undocumented |
Instance Variable | go |
Undocumented |
Instance Variable | postpath |
Undocumented |
Instance Variable | prepath |
Undocumented |
Instance Variable | proto |
Undocumented |
Instance Variable | requestheaders |
A Headers instance that stores values for all request headers. |
Instance Variable | request |
Undocumented |
Instance Variable | response |
The response code which was passed to setResponseCode. |
Instance Variable | response |
A Headers instance that stores values for all response headers. |
Instance Variable | response |
Undocumented |
Instance Variable | session |
Undocumented |
Instance Variable | sitepath |
Undocumented |
Instance Variable | written |
The bytes which have been written to the request. |
Instance Variable | _finished |
None or a list of Deferreds which will be called back with None when finish is called or which will be errbacked if processingFailed is called. |
Instance Variable | _force |
Undocumented |
Instance Variable | _server |
Undocumented |
Return dictionary mapping the names of all received headers to the last value received for each.
Since this method does not return all header information, self.requestHeaders.getAllRawHeaders() may be preferred.
NOTE: This function is a direct copy of twisted.web.http.Request.getAllRawHeaders.
twisted.web.test.test_web.DummyRequestForLogTest
getClientAddress
instead.Return the IPv4 address of the client which made this request, if there is one, otherwise None
.
Retrieve the value of a request header.
Parameters | |
name:bytes | The name of the request header for which to retrieve the value. Header names are compared case-insensitively. |
Returns | |
bytes or None | The value of the specified request header. |
Call an IPullProducer
's resumeProducing method in a loop until it unregisters itself.
Parameters | |
prod:IPullProducer | The producer. |
s | Whether or not the producer is streaming. |
Render the given resource as a response to this request.
This implementation only handles a few of the most common behaviors of resources. It can handle a render method that returns a string or NOT_DONE_YET. It doesn't know anything about the semantics of request methods (eg HEAD) nor how to set any particular headers. Basically, it's largely broken, but sufficient for some tests at least. It should not be expanded to do all the same stuff Request
does. Instead, DummyRequest
should be phased out and Request
(or some other real code factored in a different way) used.
Change the host and port the request thinks it's using.
Parameters | |
host:bytes | The value to which to change the host header. |
port | Undocumented |
ssl:bool | A flag which, if True, indicates that the request is considered secure (if True, isSecure will return True). |