Mercurial > hg > orthanc-book
annotate Sphinx/source/plugins/python/extending-rest-api.py @ 1113:a588960a72e5 default tip
spelling
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Mon, 28 Oct 2024 09:23:08 +0100 |
parents | a589668768d7 |
children |
rev | line source |
---|---|
703
a589668768d7
moving python samples in separate files (2)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 import orthanc |
a589668768d7
moving python samples in separate files (2)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 import pprint |
a589668768d7
moving python samples in separate files (2)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 |
a589668768d7
moving python samples in separate files (2)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 def OnRest(output, uri, **request): |
a589668768d7
moving python samples in separate files (2)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 pprint.pprint(request) |
a589668768d7
moving python samples in separate files (2)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 print('Accessing uri: %s' % uri) |
a589668768d7
moving python samples in separate files (2)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 output.AnswerBuffer('ok\n', 'text/plain') |
a589668768d7
moving python samples in separate files (2)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 |
a589668768d7
moving python samples in separate files (2)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 orthanc.RegisterRestCallback('/(to)(t)o', OnRest) |
a589668768d7
moving python samples in separate files (2)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 orthanc.RegisterRestCallback('/tata', OnRest) |