style: format

This commit is contained in:
Henry Li
2026-01-14 09:21:19 +08:00
parent 421488a991
commit 2aeaf7c965
5 changed files with 9 additions and 28 deletions

View File

@@ -7,7 +7,6 @@ logger = logging.getLogger(__name__)
class JinaClient:
def crawl(self, url: str, return_format: str = "html", timeout: int = 10) -> str:
headers = {
"Content-Type": "application/json",
@@ -17,17 +16,13 @@ class JinaClient:
if os.getenv("JINA_API_KEY"):
headers["Authorization"] = f"Bearer {os.getenv('JINA_API_KEY')}"
else:
logger.warning(
"Jina API key is not set. Provide your own key to access a higher rate limit. See https://jina.ai/reader for more information."
)
logger.warning("Jina API key is not set. Provide your own key to access a higher rate limit. See https://jina.ai/reader for more information.")
data = {"url": url}
try:
response = requests.post("https://r.jina.ai/", headers=headers, json=data)
if response.status_code != 200:
error_message = (
f"Jina API returned status {response.status_code}: {response.text}"
)
error_message = f"Jina API returned status {response.status_code}: {response.text}"
logger.error(error_message)
return f"Error: {error_message}"