QCDIS / NaaVRE

BSD 3-Clause "New" or "Revised" License
3 stars 2 forks source link

HTTPError: HTTP Error 308: Permanent Redirect #284

Closed skoulouzis closed 1 year ago

skoulouzis commented 2 years ago

In https://github.com/QCDIS/lifewatch-notebooks/blob/main/MULTIPLY/The_MULTIPLY_framework_v2.1.ipynb we get

HTTPError                                 Traceback (most recent call last)
Input In [16], in <cell line: 1>()
----> 1 data_access_component = DataAccessComponent()

File ~/data-access/multiply_data_access/data_access_component.py:47, in DataAccessComponent.__init__(self)
     45 def __init__(self):
     46     self._data_stores = []
---> 47     self._read_registered_data_stores()

File ~/data-access/multiply_data_access/data_access_component.py:255, in DataAccessComponent._read_registered_data_stores(self)
    254 def _read_registered_data_stores(self) -> None:
--> 255     data_stores_file = self._get_default_data_stores_file()
    256     self._read_data_stores(data_stores_file)

File ~/data-access/multiply_data_access/data_access_component.py:263, in DataAccessComponent._get_default_data_stores_file(self)
    261 if not os.path.exists(data_stores_file):
    262     open(data_stores_file, 'w+')
--> 263     self._add_default_stores()
    264 return data_stores_file

File ~/data-access/multiply_data_access/data_access_component.py:288, in DataAccessComponent._add_default_stores(self)
    285 for key, value in data_store_entry['DataStore']['MetaInfoProvider']['parameters'].items():
    286     data_store_entry['DataStore']['MetaInfoProvider']['parameters'][key] = \
    287         value.replace('user_dir', multiply_home_dir)
--> 288 meta_info_provider = create_meta_info_provider_from_dict(
    289     data_store_entry['DataStore']['MetaInfoProvider'])
    290 if 'Id' in data_store_entry['DataStore'].keys():
    291     id = data_store_entry['DataStore']['Id']

File ~/data-access/multiply_data_access/registrations.py:47, in create_meta_info_provider_from_dict(meta_info_provider_as_dict)
     45 for meta_info_provider_accessor in META_INFO_PROVIDER_REGISTRY:
     46     if meta_info_provider_accessor.name() == meta_info_provider_as_dict['type']:
---> 47         return meta_info_provider_accessor.create_from_parameters(parameters)
     48 raise UserWarning('Could not find meta info provider of type {0}'.format(meta_info_provider_as_dict['type']))

File ~/data-access/multiply_data_access/mundi_data_access.py:201, in LocallyWrappedMundiMetaInfoProviderAccessor.create_from_parameters(cls, parameters)
    199 @classmethod
    200 def create_from_parameters(cls, parameters: dict) -> LocallyWrappedMundiMetaInfoProvider:
--> 201     return LocallyWrappedMundiMetaInfoProvider(parameters)

File ~/data-access/multiply_data_access/locally_wrapped_data_access.py:89, in LocallyWrappedMetaInfoProvider.__init__(self, parameters)
     87     provided_data_types = parameters['supported_data_types']
     88 else:
---> 89     provided_data_types = ','.join(self.get_provided_data_types())
     90 self._json_meta_info_provider = JsonMetaInfoProvider(parameters['path_to_json_file'], provided_data_types)
     91 self._init_wrapped_meta_info_provider(parameters)

File ~/data-access/multiply_data_access/mundi_data_access.py:186, in LocallyWrappedMundiMetaInfoProvider.get_provided_data_types(self)
    184 def get_provided_data_types(self) -> List[str]:
    185     if not hasattr(self, '_provided_data_types'):
--> 186         self._provided_data_types = _get_provided_data_types()
    187     return self._provided_data_types

File ~/data-access/multiply_data_access/mundi_data_access.py:88, in _get_provided_data_types()
     86 def _get_provided_data_types() -> List[str]:
     87     collections_description_url = '{}{}'.format(_BASE_URL, _COLLECTIONS_DESCRIPTIONS_ADDITION)
---> 88     descriptions = urllib2.urlopen(collections_description_url).read()
     89     descriptions_root = XML(descriptions)
     90     platforms = []

File /opt/conda/lib/python3.9/urllib/request.py:214, in urlopen(url, data, timeout, cafile, capath, cadefault, context)
    212 else:
    213     opener = _opener
--> 214 return opener.open(url, data, timeout)

File /opt/conda/lib/python3.9/urllib/request.py:523, in OpenerDirector.open(self, fullurl, data, timeout)
    521 for processor in self.process_response.get(protocol, []):
    522     meth = getattr(processor, meth_name)
--> 523     response = meth(req, response)
    525 return response

File /opt/conda/lib/python3.9/urllib/request.py:632, in HTTPErrorProcessor.http_response(self, request, response)
    629 # According to RFC 2616, "2xx" code indicates that the client's
    630 # request was successfully received, understood, and accepted.
    631 if not (200 <= code < 300):
--> 632     response = self.parent.error(
    633         'http', request, response, code, msg, hdrs)
    635 return response

File /opt/conda/lib/python3.9/urllib/request.py:561, in OpenerDirector.error(self, proto, *args)
    559 if http_err:
    560     args = (dict, 'default', 'http_error_default') + orig_args
--> 561     return self._call_chain(*args)

File /opt/conda/lib/python3.9/urllib/request.py:494, in OpenerDirector._call_chain(self, chain, kind, meth_name, *args)
    492 for handler in handlers:
    493     func = getattr(handler, meth_name)
--> 494     result = func(*args)
    495     if result is not None:
    496         return result

File /opt/conda/lib/python3.9/urllib/request.py:641, in HTTPDefaultErrorHandler.http_error_default(self, req, fp, code, msg, hdrs)
    640 def http_error_default(self, req, fp, code, msg, hdrs):
--> 641     raise HTTPError(req.full_url, code, msg, hdrs, fp)

HTTPError: HTTP Error 308: Permanent Redirect

We get this error because we are missing the S3 credentials.

skoulouzis commented 2 years ago

@JorisTimmermans has a script to add the S3 credentials

skoulouzis commented 1 year ago

solved