summaryrefslogtreecommitdiffhomepage
path: root/test/python/user_group/wsgi.py
blob: 8f3ba50da81294429da498bf8c2ccfd13f0409ee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import json
import os


def application(environ, start_response):
    uid = os.geteuid()
    gid = os.getegid()

    out = json.dumps(
        {
            'UID': uid,
            'GID': gid,
        }
    ).encode('utf-8')

    start_response(
        '200 OK',
        [
            ('Content-Length', str(len(out))),
            ('Content-Type', 'application/json'),
        ],
    )

    return [out]