WSGI Server on TCP
Project description
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.
Django Example:
def index(request):
return HttpResponse(json.dumps(dict(page='index')), mimetype='application/json')
urlpatterns = patterns('',
url(r'^$', index),
)
Run Example:
$ python 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':'/'})
>>> print s.recvobj()
>>> {u'status': {u'reason': 'OK', u'code': '200'}, u'page': u'index'}
>>> s.close()
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
wsgit-0.1.tar.gz
(5.7 kB
view details)
File details
Details for the file wsgit-0.1.tar.gz
.
File metadata
- Download URL: wsgit-0.1.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4124340a61b5320d71c103331c8b8db40588e570ab056fdeba02644587889cf4 |
|
MD5 | 1ef80605db3209a9a873f8d1490b4cb3 |
|
BLAKE2b-256 | 15d0688bfed49be5ba84f65f98cd3a6db58b292a653496245d8dc889663ad199 |