Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
B
bmon
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
energy
bmon
Commits
71f56956
Commit
71f56956
authored
Jul 11, 2019
by
Alan Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed location and processing of Store Key for Things Network data.
parent
384b4d35
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
8 deletions
+5
-8
bmsapp/views.py
bmsapp/views.py
+5
-8
No files found.
bmsapp/views.py
View file @
71f56956
...
@@ -248,8 +248,8 @@ def store_readings_things(request):
...
@@ -248,8 +248,8 @@ def store_readings_things(request):
'''
'''
Stores a set of sensor readings from the Things Network in the sensor reading
Stores a set of sensor readings from the Things Network in the sensor reading
database. The readings are assumed to originate from an HTTP Integration on an
database. The readings are assumed to originate from an HTTP Integration on an
Application in the Things Network. The
Authorization header in the request contains
Application in the Things Network. The
BMON Store Key is in a custom HTTP header.
the BMON Store Key.
The readings and other data are in the POST data encoded in JSON.
The readings and other data are in the POST data encoded in JSON.
'''
'''
try
:
try
:
...
@@ -261,12 +261,9 @@ def store_readings_things(request):
...
@@ -261,12 +261,9 @@ def store_readings_things(request):
if
'payload_fields'
not
in
req_data
:
if
'payload_fields'
not
in
req_data
:
return
HttpResponse
(
'No Data'
)
return
HttpResponse
(
'No Data'
)
# See if the store key is valid. The Authorization header is of the format:
# See if the store key is valid. It's stored in the "store-key" header, which
# BMON <store key>
# is found in the "HTTP_STORE_KEY" key in the META dictionary.
try
:
storeKey
=
request
.
META
.
get
(
'HTTP_STORE_KEY'
,
'None_Present'
)
_
,
storeKey
=
request
.
META
[
'HTTP_AUTHORIZATION'
].
split
()
except
:
storeKey
=
'None_Present'
if
store_key_is_valid
(
storeKey
):
if
store_key_is_valid
(
storeKey
):
readings
=
[]
readings
=
[]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment