Skip to main content

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


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

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for WSGIT-0.3.1.tar.gz
Algorithm Hash digest
SHA256 c226c5cb57d49a7931304c9d645390a7df771397a8c0ff4f6f8983daa4f03482
MD5 fa5a3f89016c99eb48aadfce8becc790
BLAKE2b-256 7a9e17240a9c3a675b929642cf02fcb469073e3801afe1ec02dd72cda06e85ff

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