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', u'url': u'/', u'method': u'GET'}
>>> 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.3.0.tar.gz
(5.7 kB
view details)
File details
Details for the file WSGIT-0.3.0.tar.gz
.
File metadata
- Download URL: WSGIT-0.3.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 704f2fe63c3e0441384a279741871ac7e72f1d1f1773b733d024a2f162d7797e |
|
MD5 | 4c5abe622b9d5af284489ce6ed2bbcf3 |
|
BLAKE2b-256 | 00a077efe78cadfd4b99db6a5cdbba7df02fce2303485317db56b360bba402b5 |