uhttp.Request - python examples

Here are the examples of the python api uhttp.Request taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

3 View Complete Implementation : test_web_views.py
Copyright MIT License
Author : djudman
    def create_request(self, data):
        bot = EvernoteBot(self.config)
        app = namedtuple("App", ["bot"])(bot=bot)
        bytes_data = json.dumps(data).encode()
        wsgi_input = tempfile.NamedTemporaryFile(mode="rb+", suffix=".txt",
                                                 dir="/tmp")
        wsgi_input.write(bytes_data)
        wsgi_input.seek(0, 0)
        self._files.append(wsgi_input)
        request = Request({
            'wsgi.input': wsgi_input,
            'CONTENT_LENGTH': len(bytes_data),
            'QUERY_STRING': urlencode(data),
        })
        request.app = app
        return request