Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odevzdávací Systém MO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
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
Martin Mareš
Odevzdávací Systém MO
Commits
a6b4fd87
Commit
a6b4fd87
authored
5 months ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
API: Typování
parent
cc7bb550
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mo/web/api.py
+4
-4
4 additions, 4 deletions
mo/web/api.py
with
4 additions
and
4 deletions
mo/web/api.py
+
4
−
4
View file @
a6b4fd87
# Web: Interní API využívané JS funkcemi
from
flask
import
request
from
flask
import
request
,
Response
from
flask.json
import
jsonify
from
sqlalchemy
import
func
from
sqlalchemy.orm
import
joinedload
...
...
@@ -12,13 +12,13 @@ from mo.web import app
@app.route
(
'
/api/
'
)
def
api_root
():
def
api_root
()
->
Response
:
"""
Slouží jako prefix pro konstrukci URL v JavaScriptu.
"""
raise
werkzeug
.
exceptions
.
NotFound
()
@app.route
(
'
/api/find-town
'
)
def
api_find_town
():
def
api_find_town
()
->
Response
:
query
=
request
.
args
.
get
(
'
q
'
,
""
).
strip
()
if
len
(
query
)
<
2
:
return
jsonify
(
error
=
'
Zadejte alespoň 2 znaky názvu obce.
'
)
...
...
@@ -53,7 +53,7 @@ def api_find_town():
@app.route
(
'
/api/get-schools
'
)
def
api_get_schools
():
def
api_get_schools
()
->
Response
:
town
=
request
.
args
.
get
(
'
town
'
)
if
town
is
None
or
not
town
.
isnumeric
():
raise
werkzeug
.
exceptions
.
BadRequest
()
...
...
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