xref: /unit/test/python/user_group/wsgi.py (revision 1848:4bd548074e2c)
11304St.nateldemoura@f5.comimport json
21304St.nateldemoura@f5.comimport os
31304St.nateldemoura@f5.com
4*1848Szelenkov@nginx.com
51304St.nateldemoura@f5.comdef application(environ, start_response):
61304St.nateldemoura@f5.com    uid = os.geteuid()
71304St.nateldemoura@f5.com    gid = os.getegid()
81304St.nateldemoura@f5.com
9*1848Szelenkov@nginx.com    out = json.dumps({'UID': uid, 'GID': gid,}).encode('utf-8')
101304St.nateldemoura@f5.com
11*1848Szelenkov@nginx.com    start_response(
12*1848Szelenkov@nginx.com        '200 OK',
13*1848Szelenkov@nginx.com        [
14*1848Szelenkov@nginx.com            ('Content-Length', str(len(out))),
15*1848Szelenkov@nginx.com            ('Content-Type', 'application/json'),
16*1848Szelenkov@nginx.com        ],
17*1848Szelenkov@nginx.com    )
181304St.nateldemoura@f5.com
191304St.nateldemoura@f5.com    return [out]
20