Commit ffe0b610 authored by Wei Shoulin's avatar Wei Shoulin
Browse files

bytes

parent 2d128fe8
...@@ -30,7 +30,8 @@ class CatalogApi(object): ...@@ -30,7 +30,8 @@ class CatalogApi(object):
try: try:
datas = b'' datas = b''
totalCount = 0 totalCount = 0
for resp in self.stub.Gaia3Search(ephem_pb2.EphemSearchRequest(
resps = self.stub.Gaia3Search(ephem_pb2.EphemSearchRequest(
ra = ra, ra = ra,
dec = dec, dec = dec,
radius = radius, radius = radius,
...@@ -38,14 +39,15 @@ class CatalogApi(object): ...@@ -38,14 +39,15 @@ class CatalogApi(object):
maxMag = max_mag, maxMag = max_mag,
obstime = obstime, obstime = obstime,
limit = limit limit = limit
),metadata = get_auth_headers()): ),metadata = get_auth_headers())
for resp in resps:
if resp.success: if resp.success:
# data = from_proto_model_list(Gaia3Record, resp.records) # data = from_proto_model_list(Gaia3Record, resp.records)
datas = datas + resp.records datas = datas + resp.records
totalCount = resp.totalCount totalCount = resp.totalCount
else: else:
return Result.error(message = str(resp.error.detail)) return Result.error(message = str(resp.error.detail))
records = pickle.loads(datas) records = pickle.loads(datas)
ret_records2 = [] ret_records2 = []
for r in records: for r in records:
...@@ -208,7 +210,6 @@ class CatalogApi(object): ...@@ -208,7 +210,6 @@ class CatalogApi(object):
rec.NS64HIdx = r[155] rec.NS64HIdx = r[155]
rec.FileIdx = r[156] rec.FileIdx = r[156]
ret_records2.append(rec) ret_records2.append(rec)
return Result.ok_data(data = ret_records2).append("totalCount", totalCount) return Result.ok_data(data = ret_records2).append("totalCount", totalCount)
except grpc.RpcError as e: except grpc.RpcError as e:
return Result.error(message="%s:%s" % (e.code().value, e.details())) return Result.error(message="%s:%s" % (e.code().value, e.details()))
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