Skip to content

Commit f30b7e9

Browse files
feat(hubble): use fixed domain for hubble api (#349)
* feat(hubble): use fixed domain for hubble api Avoid several problems caused by unstable api.jina.ai * fix: address comment Co-authored-by: AlaeddineAbdessalem <alaeddine-13@live.fr> * fix: address comments again Co-authored-by: AlaeddineAbdessalem <alaeddine-13@live.fr>
1 parent 4f2abf8 commit f30b7e9

1 file changed

Lines changed: 2 additions & 18 deletions

File tree

docarray/array/mixins/io/pushpull.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,11 @@ def _get_hub_config() -> Optional[Dict]:
2929

3030
@lru_cache()
3131
def _get_cloud_api() -> str:
32-
"""Get Cloud Api for transmiting data to the cloud.
32+
"""Get Cloud Api for transmitting data to the cloud.
3333
34-
:raises RuntimeError: Encounter error when fetching the cloud Api Url.
3534
:return: Cloud Api Url
3635
"""
37-
if 'JINA_HUBBLE_REGISTRY' in os.environ:
38-
u = os.environ['JINA_HUBBLE_REGISTRY']
39-
else:
40-
try:
41-
req = Request(
42-
'https://api.jina.ai/hub/hubble.json',
43-
headers={'User-Agent': 'Mozilla/5.0'},
44-
)
45-
with urlopen(req) as resp:
46-
u = json.load(resp)['url']
47-
except Exception as ex:
48-
raise RuntimeError(
49-
f'Can not fetch Cloud API address from {req.full_url}'
50-
) from ex
51-
52-
return u
36+
return os.environ.get('JINA_HUBBLE_REGISTRY', 'https://api.hubble.jina.ai')
5337

5438

5539
class PushPullMixin:

0 commit comments

Comments
 (0)