Skip to main content

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(e.g. django, 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


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.1.tar.gz (4.3 kB view details)

Uploaded Source

File details

Details for the file WSGIT-0.1.1.tar.gz.

File metadata

  • Download URL: WSGIT-0.1.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for WSGIT-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a3dadec637de97bd1dd379184511fd9cd7c150d1f5639ac3b9361365b91c22c3
MD5 a46e15db3942b617636e90b401311e03
BLAKE2b-256 78606b5189cb04521b909adb95e6dfa292a1a7f96b3bed9befb15fd593431778

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page