Skip to main content

WSGI Server on TCP

Project description

About

WSGIT is a server runs WSGI applications on TCP not HTTP so that helps you make server of non-http-clients(for example 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.

Examples

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()

Changelog

  • 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


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

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for WSGIT-0.1.2.tar.gz
Algorithm Hash digest
SHA256 597dd9934f2c834718200f041bb1f66bb0a85961d4517dad50db81ec07050b7d
MD5 8304a89b9c5b8559f474a7dd8ebfd3f2
BLAKE2b-256 fb6ed39cbc9ad90aa7b0fb06951586b0d6c04a3fcf9a66f25684972f3d587bc0

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