Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Internet > HTTP (WWW)

    wsgiheaders 0.2

    Download button

    No screenshots available
    Downloads: 332  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Atsushi Odagiri | More programs
    MIT/X Consortium Lic... / FREE
    January 12th, 2009, 07:51 GMT
    ROOT / Internet / HTTP (WWW)

     Read user reviews (0)  Refer to a friend  Subscribe

    wsgiheaders description

    Adding and replacing response headers

    wsgiheaders is a Python module for adding and replacing response headers.

    >>> @replaceheader([(r'.*.html', [('Content-type', 'text/html')])])
    ... def app(environ, start_response):
    ... start_response('200 OK',
    ... [('Content-type', 'text/plain')])
    ... return ['Hello, world!']
    >>> import webtest
    >>> app = webtest.TestApp(app)
    >>> res = app.get('/a.txt')
    >>> res.content_type
    'text/plain'
    >>> res = app.get('/a.html')
    >>> res.content_type
    'text/html'
    >>> def xrds(environ):
    ... return [('X-XRDS', environ['wsgi.url_scheme'] + '://' +
    environ['SERVER_NAME'] + '/svc.xrds')]
    ...
    >>> @addheader([('http://.*', xrds)])
    ... def app(environ, start_response):
    ... start_response('200 OK',
    ... [('Content-type', 'text/plain')])
    ... return ['Hello, world!']
    >>> app = webtest.TestApp(app)
    >>> res = app.get('/')
    >>> res.headers['X-XRDS']

    'http://localhost/svc.xrds'


    Product's homepage

    Requirements:

    · Python

      


    TAGS:

    add response headers | replace response headers | Python library | wsgi | response | headers

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM