comparison Sphinx/source/plugins/python/authorization-2.py @ 704:ba2403ebd4b7

moving python samples in separate files (3)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 11 Jun 2021 10:24:08 +0200
parents
children
comparison
equal deleted inserted replaced
703:a589668768d7 704:ba2403ebd4b7
1 import json
2 import orthanc
3 import requests
4
5 def Filter(uri, **request):
6 body = {
7 'uri' : uri,
8 'headers' : request['headers']
9 }
10 r = requests.post('http://localhost:8000/authorize',
11 data = json.dumps(body))
12 return r.json() ['granted'] # Must be a Boolean
13
14 orthanc.RegisterIncomingHttpRequestFilter(Filter)