Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions legal-api/src/legal_api/reports/document_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def get_filing_report(self, drs_id: str, report_type: str):
report_type: The report type: request a certified copy for NOA and FILING report types.
return: The document binary data.
"""
headers = self._get_request_headers(BUSINESS_API_ACCOUNT_ID)
headers = self._get_request_headers(BUSINESS_API_ACCOUNT_ID, APP_PDF)
url: str = self.url.replace(DOC_PATH, "")
get_url = GET_REPORT_PATH
if report_type in (ReportTypes.FILING.value, ReportTypes.NOA.value):
Expand Down Expand Up @@ -387,7 +387,7 @@ def get_filing_document(self, drs_id: str, doc_class: str):
document_class: The DRS document class for the business to filter on.
return: The document binary data.
"""
headers = self._get_request_headers(BUSINESS_API_ACCOUNT_ID)
headers = self._get_request_headers(BUSINESS_API_ACCOUNT_ID, APP_PDF)
url: str = self.url.replace(DOC_PATH, "")
get_url = GET_DOCUMENT_PATH.format(url=url, document_class=doc_class, drs_id=drs_id)
response = requests.get(url=get_url, headers=headers)
Expand Down Expand Up @@ -478,7 +478,7 @@ def _update_static_document(self, doc: dict, doc_list: list) -> list:
return doc_list


def _get_request_headers(self, account_id: str) -> dict:
def _get_request_headers(self, account_id: str, accept_mime_type = None) -> dict:
"""
Get request headers for the DRS api call.

Expand All @@ -492,4 +492,6 @@ def _get_request_headers(self, account_id: str) -> dict:
"Content-Type": APP_PDF,
"Authorization": BEARER + token
}
if accept_mime_type:
headers["Accept"] = accept_mime_type
return headers