Commit 54cda723 authored by Wei Shoulin's avatar Wei Shoulin
Browse files

to record

parent ea741fe5
import urllib import urllib
import json import json
from csst_dfs_commons.models import Result from csst_dfs_commons.models import Result
from csst_dfs_commons.models.common import from_dict_list, Gaia3Record
class CatalogApi(object): class CatalogApi(object):
def __init__(self): def __init__(self):
self.data = [] self.data = []
...@@ -22,9 +22,9 @@ class CatalogApi(object): ...@@ -22,9 +22,9 @@ class CatalogApi(object):
resp = json.loads(html) resp = json.loads(html)
if resp["code"] == 0: 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: else:
return Result.error(message = resp.message) return Result.error(message = resp['message'])
except Exception as e: except Exception as e:
return Result.error(message=repr(e)) return Result.error(message=repr(e))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment