WSGI Server on TCP
Project description
About
WSGIT is a server which runs WSGI applications on TCP not HTTP so that helps you make server of non-http-clients(such as mobile application) with wsgi applications(like django or flask). It makes mock WSGI Request from TCP to run WSGI application. It receives json response from WSGI application and sends it as bson after adds some HTTP header information in dict.
Examples
Django Example:
def index(request):
return HttpResponse(json.dumps(dict(page='index')), mimetype='application/json')
urlpatterns = patterns('',
url(r'^$', index),
)
Run Example:
$ wsgit 0:9338 djangoproject.wsgi.application
Request Example:
>>> from socket import *
>>> import bson
>>> bson.patch_socket()
>>> s = socket(AF_INET, SOCK_STREAM)
>>> s.connect(('127.0.0.1', 9338))
>>> s.sendobj({'url':'/', 'method': 'GET'})
>>> print s.recvobj()
>>> {u'status': {u'reason': 'OK', u'code': '200'}, u'page': u'index'}
>>> s.close()
Changelog
2014.09.24: 0.2.2:
REMOTE_ADDR bug fixed
2014.09.18: 0.2.1:
Under gevent
You must put “method” parameter to choose method
CommandRequest added, some features will be implemented
2014.09.14: 0.1.3:
Supports HTTP Request headers
2013.10.05: 0.1.2:
Command wsgit supports ssl options --keyfile and --certfile
2013.10.03: 0.1.1:
Supports SSL
2013.09.22: 0.1:
create mock environ to call wsgi application
run server with command wsgit
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file WSGIT-0.2.2.tar.gz
.
File metadata
- Download URL: WSGIT-0.2.2.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46dacad498188ba948ab208eaae2a6bf3b6b28e213f6375ae01d834f1e6638de |
|
MD5 | 790e40c85fe74d5a56012a88c2da0cb4 |
|
BLAKE2b-256 | fc862f56a8ced4f0125cee3fb3c8265d96330f37745d395239fab22f2f632ad7 |