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

add print

parent ad1d3c4b
from urllib import request
import json
class EphemSearchApi(object):
def __init__(self):
self.data = []
self.url = 'http://172.31.248.218:30180/search/v2'
def gaia_query(self, ra: float, dec: float, radius: float, mag: float, limit: int):
req = request.Request(url = self.url, method="post")
req.add_header('Content-Type', 'application/json')
data = { "ra":ra, "dec":dec, "radius":radius, "mag": mag, "limit": limit}
data = json.dumps(data)
data = data.encode()
res = request.urlopen(req, data=data)
content = res.read()
print(content)
return content
\ No newline at end of file
......@@ -29,7 +29,9 @@ def ingest():
if file_type in ['obs']:
fitsApi.import2db(file_path = file_full_path.replace(root_dir, '')[1:])
print("%s [type:%s] imported" %(file_full_path, file_type))
if file_type in ['flat', 'bias', 'arc','hgar', 'sky']:
refApi.import2db(file_path = file_full_path.replace(root_dir, '')[1:])
refApi.import2db(file_path = file_full_path.replace(root_dir, '')[1:])
print("%s [type:%s] imported" %(file_full_path, file_type))
return paths
DBUtils
\ No newline at end of file
DBUtils==1.3
\ No newline at end of file
......@@ -22,6 +22,7 @@ zip_safe = False
setup_requires = setuptools_scm
install_requires =
astropy>=4.0
DBUtils==1.3
[options.package_data]
csst_dfs_api_local.common = *.sql
[options.entry_points]
......
import os
import unittest
from astropy.io import fits
from csst_dfs_api_local.common.ephem import EphemSearchApi
class CommonEphemTestCase(unittest.TestCase):
def setUp(self):
self.api = EphemSearchApi()
def test_gaia_query(self):
recs = self.api.gaia_query(ra=260, dec=-27, radius=0.01, mag=0.01, limit=2)
print('find:', recs)
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