fix(backend): update API key references to keys from env
This commit is contained in:
@@ -11,7 +11,7 @@ def search(
|
||||
) -> dict[str, Any]:
|
||||
|
||||
headers = {
|
||||
"Authorization": f"ApiKey {config.settings.elasticsearch_api_key}",
|
||||
"Authorization": f"ApiKey {config.settings.openalex_works_api_key}",
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
payload = {
|
||||
@@ -27,7 +27,7 @@ def search(
|
||||
|
||||
with httpx.Client() as client:
|
||||
response = client.post(
|
||||
f"{config.settings.elasticsearch_url}/{index}/_search",
|
||||
f"{config.settings.openalex_works_search_base_url}/{index}/_search",
|
||||
json=payload,
|
||||
headers=headers
|
||||
)
|
||||
@@ -41,7 +41,7 @@ def get(
|
||||
) -> dict[str, Any]:
|
||||
|
||||
headers = {
|
||||
"Authorization": f"ApiKey {config.settings.elasticsearch_api_key}",
|
||||
"Authorization": f"ApiKey {config.settings.openalex_works_api_key}",
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
payload = body
|
||||
@@ -49,7 +49,7 @@ def get(
|
||||
# get document directly
|
||||
with httpx.Client() as client:
|
||||
response = client.get(
|
||||
f"{config.settings.elasticsearch_url}/{index}/_doc/{doc_id}",
|
||||
f"{config.settings.openalex_works_search_base_url}/{index}/_doc/{doc_id}",
|
||||
json=payload,
|
||||
headers=headers
|
||||
)
|
||||
|
||||
@@ -100,7 +100,7 @@ def build_topic_cache(page_size: int = 200,
|
||||
"""
|
||||
output_filename: str = "topic_hierarchy_cache.json"
|
||||
headers = {
|
||||
"Authorization": f"ApiKey {config.settings.elasticsearch_api_key}",
|
||||
"Authorization": f"ApiKey {config.settings.openalex_works_api_key}",
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ def build_topic_cache(page_size: int = 200,
|
||||
"from": offset,
|
||||
"size": page_size
|
||||
}
|
||||
response = client.post(config.settings.elasticsearch_url + '/openalex-topics/_search', json=payload, headers=headers)
|
||||
response = client.post(config.settings.openalex_works_search_base_url + 'openalex-topics/_search', json=payload, headers=headers)
|
||||
response.raise_for_status()
|
||||
data = response.json()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user