Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
JoinTheCity
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
Rafal
JoinTheCity
Commits
17c4ede1
Commit
17c4ede1
authored
Jan 10, 2016
by
Dominik Rosiek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API apteki custom
parent
3584918e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
apteki.py
JoinTheCityREST/lib/api/apteki.py
+16
-10
No files found.
JoinTheCityREST/lib/api/apteki.py
View file @
17c4ede1
...
@@ -15,14 +15,20 @@ class API(BaseAPI):
...
@@ -15,14 +15,20 @@ class API(BaseAPI):
def
object
(
self
):
def
object
(
self
):
data
=
self
.
GET
(
parameters
=
self
.
request
.
GET
.
dict
())
data
=
self
.
GET
(
parameters
=
self
.
request
.
GET
.
dict
())
results
=
[]
results
=
[]
for
obj
in
data
[
'results'
]:
try
:
result
=
{}
for
obj
in
data
[
'results'
]:
for
property
in
obj
[
'properties'
]:
results
.
append
(
self
.
unpack
(
obj
))
if
property
[
'key'
]
==
'APTEKI'
:
except
TypeError
as
e
:
result
[
'name'
]
=
property
[
'value'
]
results
.
append
(
self
.
unpack
(
data
[
'results'
]))
elif
property
[
'key'
]
==
'OADR_GPS_S'
:
result
[
'latitude'
]
=
property
[
'value'
]
elif
property
[
'key'
]
==
'OADR_GPS_D'
:
result
[
'longitude'
]
=
property
[
'value'
]
results
.
append
(
result
)
return
json
.
dumps
(
results
)
return
json
.
dumps
(
results
)
def
unpack
(
self
,
obj
):
result
=
{}
for
property
in
obj
[
'properties'
]:
if
property
[
'key'
]
==
'APTEKI'
:
result
[
'name'
]
=
property
[
'value'
]
elif
property
[
'key'
]
==
'OADR_GPS_S'
:
result
[
'latitude'
]
=
property
[
'value'
]
elif
property
[
'key'
]
==
'OADR_GPS_D'
:
result
[
'longitude'
]
=
property
[
'value'
]
return
result
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