mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
Swapping out the tika and replaces requests with httpx
This commit is contained in:
@@ -2,7 +2,7 @@ import os
|
||||
from pathlib import Path
|
||||
|
||||
import dateutil.parser
|
||||
import requests
|
||||
import httpx
|
||||
from django.conf import settings
|
||||
from tika import parser
|
||||
|
||||
@@ -106,7 +106,7 @@ class TikaDocumentParser(DocumentParser):
|
||||
data["pdfFormat"] = "PDF/A-3b"
|
||||
|
||||
try:
|
||||
response = requests.post(url, files=files, headers=headers, data=data)
|
||||
response = httpx.post(url, files=files, headers=headers, data=data)
|
||||
response.raise_for_status() # ensure we notice bad responses
|
||||
except Exception as err:
|
||||
raise ParseError(
|
||||
|
11
src/paperless_tika/tests/utils.py
Normal file
11
src/paperless_tika/tests/utils.py
Normal file
@@ -0,0 +1,11 @@
|
||||
import pytest
|
||||
from pytest_httpx import HTTPXMock
|
||||
|
||||
|
||||
class HttpxMockMixin:
|
||||
@pytest.fixture(autouse=True)
|
||||
def httpx_mock_auto(self, httpx_mock: HTTPXMock):
|
||||
"""
|
||||
Workaround for allowing use of a fixture with unittest style testing
|
||||
"""
|
||||
self.httpx_mock = httpx_mock
|
Reference in New Issue
Block a user