Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

The get_json() method should be used instead.

  • Loading branch information...
commit feaafb78486a4b93439707a9cffc2d6ddf04b91b 1 parent 4da6917
@nycholas nycholas authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 examples/decorator/decorator.py
View
4 examples/decorator/decorator.py 100644 → 100755
@@ -48,7 +48,7 @@
def check_terminal_id(fn):
def wrapped():
- terminal_id = int(request.json.get('terminal_id', 0))
+ terminal_id = int(request.get_json(silent=True).get('terminal_id', 0))
if terminal_id <= 0:
raise OtherError('Invalid terminal ID')
return fn()
@@ -57,7 +57,7 @@ def wrapped():
@jsonrpc.method('App.index')
@check_terminal_id
def index():
- return u'Terminal ID: {0}'.format(request.json['terminal_id'])
+ return u'Terminal ID: {0}'.format(request.get_json(silent=True).get('terminal_id', 0))
if __name__ == '__main__':
Please sign in to comment.
Something went wrong with that request. Please try again.