Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AUTO-soa-lab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eckl, Máté
AUTO-soa-lab
Commits
9b92e640
Commit
9b92e640
authored
Mar 31, 2017
by
dnsadmin
Browse files
Options
Downloads
Patches
Plain Diff
Retab és 1. Feladat
parent
c5961896
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
service.py
+163
-119
163 additions, 119 deletions
service.py
with
163 additions
and
119 deletions
service.py
+
163
−
119
View file @
9b92e640
...
@@ -139,6 +139,50 @@ def verb_test():
...
@@ -139,6 +139,50 @@ def verb_test():
# it also shows you how to access the method used and the decoded JSON data
# it also shows you how to access the method used and the decoded JSON data
return
jsonify
(
method
=
request
.
method
,
data
=
request
.
get_json
(),
url
=
request
.
url
)
return
jsonify
(
method
=
request
.
method
,
data
=
request
.
get_json
(),
url
=
request
.
url
)
@app.route
(
'
/jarmuvek.json
'
,
methods
=
[
"
GET
"
])
def
vehicles
():
conn
=
get_db
()
try
:
cur
=
conn
.
cursor
()
try
:
cur
.
execute
(
'
select jarmu_kulcs, rendszam, uzembehelyezes from jarmu
'
)
results
=
[]
for
id
,
rsz
,
uh
in
cur
:
results
.
append
({
'
jarmu_kulcs
'
:
id
,
'
rendszam
'
:
rsz
,
'
uzembehelyezes
'
:
uh
.
isoformat
()})
return
jsonify
(
jarmuvek
=
results
)
finally
:
cur
.
close
()
finally
:
conn
.
close
()
@app.route
(
'
/jarmuvek/<jarmu_kulcs>.json
'
)
def
show_vehicle
(
jarmu_kulcs
):
conn
=
get_db
()
try
:
try
:
cur
=
conn
.
cursor
()
cur
.
execute
(
'
select telephely, berelheto, rendszam, alvazszam, uzembehelyezes, muszaki_ervenyesseg, marka, tipus, szin, teljesitmeny, ulesek, legkondicionalo from jarmu where jarmu_kulcs= :jk
'
,
jk
=
jarmu_kulcs
)
results
=
[]
for
telephely
,
berelheto
,
rendszam
,
alvazszam
,
uzembehelyezes
,
muszaki_ervenyesseg
,
marka
,
tipus
,
szin
,
teljesitmeny
,
ulesek
,
legkondicionalo
in
cur
:
results
.
append
({
"
telephely
"
:
telephely
,
"
berelheto
"
:
bool
(
berelheto
),
"
rendszam
"
:
rendszam
,
"
alvazszam
"
:
alvazszam
,
"
uzembehelyezes
"
:
uzembehelyezes
.
isoformat
(),
"
muszaki_ervenyesseg
"
:
muszaki_ervenyesseg
.
isoformat
(),
"
marka
"
:
marka
,
"
tipus
"
:
tipus
,
"
szin
"
:
szin
,
"
teljesitmeny
"
:
teljesitmeny
,
"
ulesek
"
:
ulesek
,
"
legkondicionalo
"
:
bool
(
legkondicionalo
)
})
return
jsonify
(
jarmuvek
=
results
)
finally
:
cur
.
close
()
finally
:
conn
.
close
()
def
get_db
():
def
get_db
():
"""
Connects to the RDBMS and returns a connection object
"""
"""
Connects to the RDBMS and returns a connection object
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment