Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-dfs
csst-dfs-api-local
Commits
54cda723
Commit
54cda723
authored
Jun 10, 2021
by
Wei Shoulin
Browse files
to record
parent
ea741fe5
Changes
1
Show whitespace changes
Inline
Side-by-side
csst_dfs_api_local/common/catalog.py
View file @
54cda723
import
urllib
import
json
from
csst_dfs_commons.models
import
Result
from
csst_dfs_commons.models.common
import
from_dict_list
,
Gaia3Record
class
CatalogApi
(
object
):
def
__init__
(
self
):
self
.
data
=
[]
...
...
@@ -22,9 +22,9 @@ class CatalogApi(object):
resp
=
json
.
loads
(
html
)
if
resp
[
"code"
]
==
0
:
return
Result
.
ok_data
(
data
=
resp
[
"data"
]).
append
(
"totalCount"
,
resp
[
"object"
][
"totalCount"
])
return
Result
.
ok_data
(
data
=
from_dict_list
(
Gaia3Record
,
resp
[
"data"
])
)
.
append
(
"totalCount"
,
resp
[
"object"
][
"totalCount"
])
else
:
return
Result
.
error
(
message
=
resp
.
message
)
return
Result
.
error
(
message
=
resp
[
'
message
'
]
)
except
Exception
as
e
:
return
Result
.
error
(
message
=
repr
(
e
))
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment