Skip to content

armgit / mwmbl

Public Imported from GitHub
0

An open source, non-profit web search engine

Update crawler to use new auth

Daoud Clarke00cf6c3069c5
diff --git a/mwmbl/crawl.py b/mwmbl/crawl.py
index e9a9e19..11d57c4 100644
--- a/mwmbl/crawl.py
+++ b/mwmbl/crawl.py
@@ -195,10 +195,12 @@ class Crawler:
if new_high_score:
result_items = [Result(url=doc.url, title=doc.title, extract=doc.extract,
score=doc.score, term=doc.term, state=doc.state) for doc in new_items]
- results = Results(api_key=MWMBL_API_KEY, results=result_items, crawler_version=CRAWLER_VERSION)
+ results = Results(results=result_items, crawler_version=CRAWLER_VERSION)
logger.info(f"Posting {len(result_items)} results")
response = requests.post(
- "https://api.mwmbl.org/api/v1/crawler/results", json=results.dict()
+ "https://api.mwmbl.org/api/v1/crawler/results",
+ json=results.dict(),
+ headers={"X-API-Key": MWMBL_API_KEY},
)
logger.info(f"Response: {response.text}")
response.raise_for_status()