Skip to content

Commit

Permalink
fixing over indent
Browse files Browse the repository at this point in the history
  • Loading branch information
jeisenman23 committed Jan 7, 2025
1 parent 0e6b9f9 commit 18a4465
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions elm/web/osti.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ def _get_first(self):
self._response = self._session.get(self.url)

if not self._response.ok:
msg = f'''OSTI API Request got error {self._response.status_code}:
msg = f'''OSTI API Request got error
{self._response.status_code}:
"{self._response.reason}"'''
raise RuntimeError(msg)

Expand Down Expand Up @@ -326,26 +327,25 @@ def _get_all(self, n_pages):

def download(self, out_dir):
"""Download all PDFs from the records in this OSTI object into a
directory. PDFs will be given file names based on their OSTI
record ID
directory. PDFs will be given file names based on their OSTI record
ID
Parameters
----------
out_dir : str
Directory to download PDFs to. This directory will be created if
it does not already exist.
"""
logger.info('Downloading {} records to: {}'
.format(len(self), out_dir))
logger.info(f'Downloading {len(self)} records to: {out_dir}')
os.makedirs(out_dir, exist_ok=True)
for record in self:
fp_out = os.path.join(out_dir, record.osti_id + '.pdf')
if not os.path.exists(fp_out):
try:
record.download(fp_out)
except Exception as e:
msg = f'''Could not download OSTI ID {record.osti_id}
"{record.title}": {e}'''
msg = (f'Could not download OSTI ID {record.osti_id} '
f'"{record.title}": {e}')
logger.exception(msg)

logger.info('Finished download!')
Expand Down

0 comments on commit 18a4465

Please sign in to comment.