Problem on accessing NWB files in BrainObservatory Cache

Hi everyone,
It’s really cool of you guys to share all these data online. I am currently working on the VIsp’s 2P data, here’s my code to download the original nwb files on my server:

from allensdk.core.brain_observatory_cache import BrainObservatoryCache
import pprint
from pathlib import Path

output_dir = '.'
boc =  BrainObservatoryCache(
    manifest_file=str(Path(output_dir) / 'brain_observatory_manifest.json'))

data_set = boc.get_ophys_experiment_data(502205092)

It work well before, but today I encountered HTTP 403 error over and over again.the traceback goes like below:

{
	"name": "HTTPError",
	"message": "HTTP Error 403: Forbidden",
	"stack": "---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
Cell In[19], line 1
----> 1 exp = boc.get_ophys_experiments(experiment_container_ids=[595263152], 
      2                                 session_types = ['three_session_A'])[0]
      3 pprint.pprint(exp)

File ~/anaconda3/envs/pytorch/lib/python3.11/site-packages/allensdk/core/brain_observatory_cache.py:367, in BrainObservatoryCache.get_ophys_experiments(self, file_name, ids, experiment_container_ids, targeted_structures, imaging_depths, cre_lines, reporter_lines, transgenic_lines, stimuli, session_types, cell_specimen_ids, include_failed, require_eye_tracking, simple)
    359 exps = self.api.get_ophys_experiments(
    360     path=file_name, strategy=\"lazy\", **Cache.cache_json()
    361 )
    363 # NOTE: Ugly hack to update the 'fail_eye_tracking' field
    364 # which is using True/False values for the previous eye mapping
    365 # implementation. This will also need to be fixed in warehouse.
    366 # ----- Start of ugly hack -----
--> 367 response = self.api.template_query(
    368     \"brain_observatory_queries\", \"all_eye_mapping_files\"
    369 )
    371 session_ids_with_eye_tracking: set = {
    372     entry[\"attachable_id\"]
    373     for entry in response
    374     if entry[\"attachable_type\"] == \"OphysSession\"
    375 }
    377 for indx, exp in enumerate(exps):

File ~/anaconda3/envs/pytorch/lib/python3.11/site-packages/allensdk/api/queries/rma_template.py:132, in RmaTemplate.template_query(self, template_name, entry_name, **kwargs)
    128     query_args['order'] = template['order']
    130 query_args.update(kwargs)
--> 132 data = self.model_query(**query_args)
    134 return data

File ~/anaconda3/envs/pytorch/lib/python3.11/site-packages/allensdk/api/queries/rma_api.py:257, in RmaApi.model_query(self, *args, **kwargs)
    217 def model_query(self, *args, **kwargs):
    218     '''Construct and execute a model stage of an RMA query string.
    219 
    220     Parameters
   (...)
    255     response, including the normalized query.
    256     '''
--> 257     return self.json_msg_query(
    258         self.build_query_url(
    259             self.model_stage(*args, **kwargs)))

File ~/anaconda3/envs/pytorch/lib/python3.11/site-packages/allensdk/api/api.py:164, in Api.json_msg_query(self, url, dataframe)
    147 def json_msg_query(self, url, dataframe=False):
    148     ''' Common case where the url is fully constructed
    149         and the response data is stored in the 'msg' field.
    150 
   (...)
    161         returned data; type depends on dataframe option
    162     '''
--> 164     data = self.do_query(lambda *a, **k: url,
    165                          self.read_data)
    167     if dataframe is True:
    168         warnings.warn(\"dataframe argument is deprecated\", DeprecationWarning)

File ~/anaconda3/envs/pytorch/lib/python3.11/site-packages/allensdk/api/api.py:204, in Api.do_query(self, url_builder_fn, json_traversal_fn, *args, **kwargs)
    200 api_url = url_builder_fn(*args, **kwargs)
    202 post = kwargs.get('post', False)
--> 204 json_parsed_data = self.retrieve_parsed_json_over_http(api_url, post)
    206 return json_traversal_fn(json_parsed_data)

File ~/anaconda3/envs/pytorch/lib/python3.11/site-packages/allensdk/api/api.py:369, in Api.retrieve_parsed_json_over_http(self, url, post)
    366 self._log.info(\"Downloading URL: %s\", url)
    368 if post is False:
--> 369     data = json_utilities.read_url_get(
    370         requests.utils.quote(url,
    371                              ';/?:@&=+$,'))
    372 else:
    373     data = json_utilities.read_url_post(url)

File ~/anaconda3/envs/pytorch/lib/python3.11/site-packages/allensdk/core/json_utilities.py:115, in read_url_get(url)
     98 def read_url_get(url):
     99     \"\"\"Transform a JSON contained in a file into an equivalent
    100     nested python dict.
    101 
   (...)
    113     the output will be of the corresponding type.
    114     \"\"\"
--> 115     response = urllib_request.urlopen(url)
    116     json_string = response.read().decode(\"utf-8\")
    118     return json.loads(json_string)

File ~/anaconda3/envs/pytorch/lib/python3.11/urllib/request.py:216, in urlopen(url, data, timeout, cafile, capath, cadefault, context)
    214 else:
    215     opener = _opener
--> 216 return opener.open(url, data, timeout)

File ~/anaconda3/envs/pytorch/lib/python3.11/urllib/request.py:525, in OpenerDirector.open(self, fullurl, data, timeout)
    523 for processor in self.process_response.get(protocol, []):
    524     meth = getattr(processor, meth_name)
--> 525     response = meth(req, response)
    527 return response

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

File ~/anaconda3/envs/pytorch/lib/python3.11/urllib/request.py:563, in OpenerDirector.error(self, proto, *args)
    561 if http_err:
    562     args = (dict, 'default', 'http_error_default') + orig_args
--> 563     return self._call_chain(*args)

File ~/anaconda3/envs/pytorch/lib/python3.11/urllib/request.py:496, in OpenerDirector._call_chain(self, chain, kind, meth_name, *args)
    494 for handler in handlers:
    495     func = getattr(handler, meth_name)
--> 496     result = func(*args)
    497     if result is not None:
    498         return result

File ~/anaconda3/envs/pytorch/lib/python3.11/urllib/request.py:643, in HTTPDefaultErrorHandler.http_error_default(self, req, fp, code, msg, hdrs)
    642 def http_error_default(self, req, fp, code, msg, hdrs):
--> 643     raise HTTPError(req.full_url, code, msg, hdrs, fp)

HTTPError: HTTP Error 403: Forbidden"
}

However, to double check, I tried the VisualBehaviorOphysProjectCache as well:

from pathlib import Path
import matplotlib.pyplot as plt

import allensdk
from allensdk.brain_observatory.behavior.behavior_project_cache import VisualBehaviorOphysProjectCache

output_dir = "/local1/visual_behavior_ophys_cache_dir"
output_dir = Path(output_dir)

cache = VisualBehaviorOphysProjectCache.from_s3_cache(cache_dir=output_dir)
behavior_session = cache.get_behavior_session(behavior_session_id=870987812)

This time it works well. and I also notice that the Brain Map website is currently down, so I am wondering if this issue is related to the website being temporarily closed or if there are other access restrictions in place? Additionally, could you let me know when the website or data download functionality will be re-enabled?THX a lot :face_holding_back_tears:

Hey, I am having the same issue with this code:

boc = BrainObservatoryCache(manifest_file=str(Path(allen_cache_path) / Path(‘brain_observatory_manifest.json’)))
cell_exp = boc.get_ophys_experiments(experiment_container_ids=[511511001])
I get a 403 HTTP error.

Following up on this because it seems to be the case for the Cell Types Database (ephys patch clamp data) as well.

I teach with this dataset in my course each semester, and the plan was to work with it this week. Students access both the website online and also work in a code notebook with the data. I tested out my materials earlier last week and they worked. Now, I’m also seeing that the online website won’t load, and receive a similar error when trying to access the dataset.

Any updates on these resources would be appreciated, thanks!

Thank you for bringing this to our attention.

We’re looking into what’s causing the current outage and are hoping for a quick resolution.

We’ll post here once the issues are resolved.

The site is back up. Thank you for your patience.

Please let us know if you run into any further issues.

Just to update, I checked my code for downloading the files online and it works well now!
Thanks a lot for the quick resolution of the team :smiling_face: