Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
smogonet
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dominik Rosiek
smogonet
Commits
bf8cd149
Commit
bf8cd149
authored
Dec 20, 2016
by
Maksymilian Chodacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JSON view format
parent
1fb48312
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
measurement_viewer.py
measurement_viewer.py
+11
-3
No files found.
measurement_viewer.py
View file @
bf8cd149
...
@@ -4,6 +4,7 @@ import tornado.ioloop
...
@@ -4,6 +4,7 @@ import tornado.ioloop
import
tornado.web
import
tornado.web
import
models
import
models
from
tornado
import
gen
from
tornado
import
gen
import
json
class
MainHandler
(
tornado
.
web
.
RequestHandler
):
class
MainHandler
(
tornado
.
web
.
RequestHandler
):
...
@@ -12,10 +13,17 @@ class MainHandler(tornado.web.RequestHandler):
...
@@ -12,10 +13,17 @@ class MainHandler(tornado.web.RequestHandler):
stations
=
yield
models
.
Station
.
get_all
()
stations
=
yield
models
.
Station
.
get_all
()
pollutions
=
yield
models
.
Type
.
get_all
()
pollutions
=
yield
models
.
Type
.
get_all
()
last_measurements
=
yield
models
.
Measurement
.
get_all_last
()
last_measurements
=
yield
models
.
Measurement
.
get_all_last
()
response
=
dict
()
for
measurement
in
last_measurements
:
for
measurement
in
last_measurements
:
self
.
write
(
str
(
measurement
))
data
=
{
self
.
write
(
"
\n
"
)
"station_name"
:
measurement
.
station
.
name
,
"type"
:
measurement
.
type
.
shortname
,
"value"
:
measurement
.
value
,
"time"
:
measurement
.
time
}
response
[
measurement
.
id
]
=
data
self
.
set_header
(
'Content-Type'
,
'application/json'
)
self
.
write
(
json
.
dumps
(
response
))
def
make_app
():
def
make_app
():
...
...
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