8000 feat(hubble): use fixed domain for hubble api by mapleeit · Pull Request #4804 · jina-ai/serve · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(hubble): use fixed domain for hubble api #4804

New issue 8000

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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