Skip to content

Commit

Permalink
found one more instance
Browse files Browse the repository at this point in the history
  • Loading branch information
pudo committed Jul 17, 2024
1 parent aebc29d commit 27d84dd
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions yente/data/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
from rigour.text.distance import levenshtein
from fingerprints import remove_types, clean_name_light
from nomenklatura.util import fingerprint_name, names_word_list
from yente.settings import HTTP_PROXY, VERSION, AUTH_TOKEN

from yente import settings


@lru_cache(maxsize=5000)
Expand Down Expand Up @@ -133,16 +134,16 @@ def auth_flow(
self, request: httpx.Request
) -> Generator[httpx.Request, httpx.Response, None]:
response = yield request
if response.status_code == 401 and AUTH_TOKEN:
request.headers["Authentication"] = f"Token {AUTH_TOKEN}"
if response.status_code == 401 and settings.AUTH_TOKEN:
request.headers["Authentication"] = f"Token {settings.AUTH_TOKEN}"
yield request


@asynccontextmanager
async def httpx_session() -> AsyncGenerator[httpx.AsyncClient, None]:
transport = httpx.AsyncHTTPTransport(retries=3)
proxy = HTTP_PROXY if HTTP_PROXY != "" else None
headers = {"User-Agent": f"Yente/{VERSION}"}
proxy = settings.HTTP_PROXY if settings.HTTP_PROXY != "" else None
headers = {"User-Agent": f"Yente/{settings.VERSION}"}
async with httpx.AsyncClient(
transport=transport,
http2=True,
Expand Down

0 comments on commit 27d84dd

Please sign in to comment.