diff --git a/nexradaws/nexradawsinterface.py b/nexradaws/nexradawsinterface.py
index 63ceb75..8b4ba0f 100644
--- a/nexradaws/nexradawsinterface.py
+++ b/nexradaws/nexradawsinterface.py
@@ -47,7 +47,8 @@ class NexradAwsInterface(object):
         """
         years = []
         resp = self._bucket.meta.client.list_objects(Bucket='noaa-nexrad-level2',Delimiter='/')
-        for each in resp.get('CommonPrefixes'):
+
+        for each in resp.get('CommonPrefixes', []):
             match = self._year_re.match(each.get('Prefix'))
             if match is not None:
                 years.append(match.group(1))
@@ -72,7 +73,7 @@ class NexradAwsInterface(object):
         resp = self._bucket.meta.client.list_objects(Bucket='noaa-nexrad-level2',
                                                      Prefix=prefix,
                                                      Delimiter='/')
-        for each in resp.get('CommonPrefixes'):
+        for each in resp.get('CommonPrefixes', []):
             match = self._month_re.match(each.get('Prefix'))
             if match is not None:
                 months.append(match.group(1))
@@ -98,7 +99,7 @@ class NexradAwsInterface(object):
         resp = self._bucket.meta.client.list_objects(Bucket='noaa-nexrad-level2',
                                                      Prefix=prefix,
                                                      Delimiter='/')
-        for each in resp.get('CommonPrefixes'):
+        for each in resp.get('CommonPrefixes', []):
             match = self._day_re.match(each.get('Prefix'))
             if match is not None:
                 days.append(match.group(1))
@@ -126,7 +127,7 @@ class NexradAwsInterface(object):
         resp = self._bucket.meta.client.list_objects(Bucket='noaa-nexrad-level2',
                                                      Prefix=prefix,
                                                      Delimiter='/')
-        for each in resp.get('CommonPrefixes'):
+        for each in resp.get('CommonPrefixes', []):
             match = self._radar_re.match(each.get('Prefix'))
             if match is not None:
                 radars.append(match.group(1))
@@ -157,7 +158,7 @@ class NexradAwsInterface(object):
         resp = self._bucket.meta.client.list_objects(Bucket='noaa-nexrad-level2',
                                                      Prefix=prefix,
                                                      Delimiter='/')
-        for scan in resp.get('Contents'):
+        for scan in resp.get('Contents', []):
             match = self._scan_re.match(scan.get('Key'))
             if match is not None:
                 scans.append(AwsNexradFile(scan))

Function get_avail_scans should check for existence of resp['Contents']
If no data at all is available for a given date, then resp['Contents'] does not exist in the function get_avail_scans. This raises an error, while more desired behaviour is to return an empty list I think. 

I found this issue because I wanted to retrieve data for a given time range for one day, for which there indeed is data. For the next date there however there is no data, and it appears that the function get_avail_scans_in_range includes by default the next date in its attempt to obtain available scans, if the time span is nonzero. The error that I mentioned above caused get_avail_scans_in_range to return an error, instead of a list with scans that were in fact available.

Here is a simple fix:
`if 'Contents' in resp:
            for scan in resp.get('Contents'):
                match = self._scan_re.match(scan.get('Key'))
                if match is not None:
                    scans.append(AwsNexradFile(scan))`
diff --git a/tests/test_nexradAwsInterface.py b/tests/test_nexradAwsInterface.py
index 01b5947..32cf370 100644
--- a/tests/test_nexradAwsInterface.py
+++ b/tests/test_nexradAwsInterface.py
@@ -40,21 +40,37 @@ class TestNexradAwsInterface(TestCase):
         six.assertCountEqual(self, months, examplemonths)
         self.assertEqual(12, len(months))
 
+    def test_get_available_months_missing(self):
+        months = self.query.get_avail_months('1900')
+        self.assertEqual(months, [])
+
     def test_get_available_days(self):
         days = self.query.get_avail_days('2006', '05')
         self.assertIsInstance(days, list)
         self.assertEqual(31, len(days))
         six.assertCountEqual(self, days, exampledays)
 
+    def test_get_available_days_missing(self):
+        days = self.query.get_avail_days('2006', '13')
+        self.assertEqual(days, [])
+
     def test_get_available_radars(self):
         radars = self.query.get_avail_radars('2006', '05', '31')
         self.assertIsInstance(radars, list)
         self.assertTrue('KTLX' in radars)
 
+    def test_get_available_radars_missing(self):
+        radars = self.query.get_avail_radars('1900', '05', '31')
+        self.assertEqual(radars, [])
+
     def test_get_available_scans(self):
         scans = self.query.get_avail_scans('2006', '05', '31', 'KTLX')
         self.assertIsInstance(scans, list)
 
+    def test_get_available_scan_missing(self):
+        scans = self.query.get_avail_scans('1991', '05', '31', 'KTLX')
+        self.assertEqual(scans, [])
+
     def test_get_available_scans_in_range(self):
         start = datetime(2013, 5, 20, 18, 00)
         end = datetime(2013, 5, 20, 22, 00)

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest coverage
3.9
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
boto3==1.37.23
botocore==1.37.23
coverage==7.8.0
exceptiongroup==1.2.2
iniconfig==2.1.0
jmespath==1.0.1
-e git+https://github.com/aarande/nexradaws.git@f9a8a73b982f9392b9a7af30db4fb2572d37c1c1#egg=nexradaws
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
python-dateutil==2.9.0.post0
pytz==2025.2
s3transfer==0.11.4
six==1.17.0
tomli==2.2.1
urllib3==1.26.20

name: nexradaws
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - boto3==1.37.23
      - botocore==1.37.23
      - coverage==7.8.0
      - exceptiongroup==1.2.2
      - iniconfig==2.1.0
      - jmespath==1.0.1
      - packaging==24.2
      - pluggy==1.5.0
      - pytest==8.3.5
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - s3transfer==0.11.4
      - six==1.17.0
      - tomli==2.2.1
      - urllib3==1.26.20
prefix: /opt/conda/envs/nexradaws

tests/test_nexradAwsInterface.py::TestNexradAwsInterface::test_get_available_days_missing tests/test_nexradAwsInterface.py::TestNexradAwsInterface::test_get_available_months_missing tests/test_nexradAwsInterface.py::TestNexradAwsInterface::test_get_available_radars_missing tests/test_nexradAwsInterface.py::TestNexradAwsInterface::test_get_available_scan_missing
tests/test_nexradAwsInterface.py::TestNexradAwsInterface::test_aws_structure tests/test_nexradAwsInterface.py::TestNexradAwsInterface::test_download_multiple tests/test_nexradAwsInterface.py::TestNexradAwsInterface::test_download_single tests/test_nexradAwsInterface.py::TestNexradAwsInterface::test_download_single_2017 tests/test_nexradAwsInterface.py::TestNexradAwsInterface::test_formattimerange_localtime tests/test_nexradAwsInterface.py::TestNexradAwsInterface::test_formattimerange_utc tests/test_nexradAwsInterface.py::TestNexradAwsInterface::test_get_available_days tests/test_nexradAwsInterface.py::TestNexradAwsInterface::test_get_available_months tests/test_nexradAwsInterface.py::TestNexradAwsInterface::test_get_available_radars tests/test_nexradAwsInterface.py::TestNexradAwsInterface::test_get_available_scans tests/test_nexradAwsInterface.py::TestNexradAwsInterface::test_get_available_scans_in_range tests/test_nexradAwsInterface.py::TestNexradAwsInterface::test_get_available_years tests/test_nexradAwsInterface.py::TestNexradAwsInterface::test_open_file tests/test_nexradAwsInterface.py::TestNexradAwsInterface::test_open_pyart tests/test_nexradAwsInterface.py::TestNexradAwsInterface::test_prefix_build tests/test_nexradAwsInterface.py::TestNexradAwsInterface::test_prefix_build_type
nexradaws/nexradawsinterface.py
nexradaws/nexradawsinterface.py