Skip to content

Commit

Permalink
feat(hubble): use fixed domain for hubble api (#4804)
Browse files Browse the repository at this point in the history
  • Loading branch information
mapleeit committed May 19, 2022
1 parent 9415311 commit c88d2cf
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions jina/hubble/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,27 +94,11 @@ def get_download_cache_dir() -> Path:

@lru_cache()
def _get_hubble_base_url() -> str:
"""Get base Hubble Url from api.jina.ai or os.environ
"""Get base Hubble Url from os.environ or constants
:return: base Hubble Url
"""
if 'JINA_HUBBLE_REGISTRY' in os.environ:
u = os.environ['JINA_HUBBLE_REGISTRY']
else:
try:
req = Request(
'https://api.jina.ai/hub/hubble.json',
headers={'User-Agent': 'Mozilla/5.0'},
)
with urlopen(req) as resp:
u = json.load(resp)['url']
except:
default_logger.critical(
'Can not fetch the Url of Hubble from `api.jina.ai`'
)
raise

return u
return os.environ.get('JINA_HUBBLE_REGISTRY', 'https://api.hubble.jina.ai')


@lru_cache()
Expand Down

0 comments on commit c88d2cf

Please sign in to comment.