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
2729b3a9
Commit
2729b3a9
authored
Dec 04, 2016
by
Dominik Rosiek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working tornado
parent
85ce8b66
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
15 deletions
+16
-15
db_app.py
db_app.py
+16
-15
No files found.
db_app.py
View file @
2729b3a9
import
gen
as
gen
from
db
import
DDBmeasurements
from
db
import
DDBmeasurements
import
tornado.ioloop
import
tornado.ioloop
import
tornado.web
from
tornado
import
web
,
gen
import
tornado.gen
import
tornado.options
class
MeasurementHandler
(
web
.
RequestHandler
):
class
MeasurementHandler
(
web
.
RequestHandler
):
@
gen
.
coroutine
#
@gen.coroutine
def
post
(
self
,
measurement_id
):
#
def post(self, measurement_id):
station_id
=
self
.
get_body_argument
(
'station_id'
)
#
station_id = self.get_body_argument('station_id')
type_id
=
self
.
get_body_argument
(
'type_id'
)
#
type_id = self.get_body_argument('type_id')
measurement
=
DDBUserWallet
()
# measurement = DDBmeasurements
()
yield
user_wallet
.
update
(
user_id
=
user_id
,
balance
=
int
(
balance
))
# yield measurement.add
(user_id=user_id, balance=int(balance))
self
.
write
(
'Updated
\n
'
)
#
self.write('Updated\n')
@
gen
.
coroutine
@
gen
.
coroutine
def
get
(
self
,
user_id
):
def
get
(
self
,
measurement_id
=
'0af4ea1b-f2af-4173-bffb-1a54d5081931'
):
measurement_id
=
'0af4ea1b-f2af-4173-bffb-1a54d5081931'
measurement
=
DDBmeasurements
()
measurement
=
DDBmeasurements
()
response
=
yield
measurement
.
get
(
measurement_id
=
measurement_id
)
response
=
yield
measurement
.
get
(
measurement_id
=
measurement_id
)
self
.
write
(
'{station_id}
\n
'
.
format
(
station_id
=
response
[
'station_id'
]))
self
.
write
(
'measurement_id: {measurement_id}<br />
\n
'
.
format
(
measurement_id
=
response
[
'measurement_id'
]))
self
.
write
(
'{type_id}
\n
'
.
format
(
type_id
=
response
[
'type_id'
]))
self
.
write
(
'station_id: {station_id}<br />
\n
'
.
format
(
station_id
=
response
[
'station_id'
]))
self
.
write
(
'type_id: {type_id}<br />
\n
'
.
format
(
type_id
=
response
[
'type_id'
]))
application
=
web
.
Application
([
application
=
web
.
Application
([
...
@@ -32,7 +33,7 @@ application = web.Application([
...
@@ -32,7 +33,7 @@ application = web.Application([
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
DDBmeasurements
()
.
create_table
()
DDBmeasurements
()
.
create_table
()
application
.
listen
(
80
)
application
.
listen
(
80
90
)
#ioloop.IOLoop.instance().start()
#ioloop.IOLoop.instance().start()
tornado
.
ioloop
.
IOLoop
.
current
()
.
start
()
tornado
.
ioloop
.
IOLoop
.
current
()
.
start
()
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