-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add sections, subsections generation
- Loading branch information
1 parent
0aa970b
commit cdc3cbf
Showing
6 changed files
with
246 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
KEY= | ||
YANDEX_GPT_KEY= | ||
ELSEVIER_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import os | ||
import requests | ||
|
||
ELSEVIER_KEY = os.getenv("ELSEVIER_KEY") | ||
if (ELSEVIER_KEY is None): | ||
raise Exception("ELSEVIER_KEY does not exist in .env") | ||
|
||
class Elsevier: | ||
@staticmethod | ||
def search(query: str, show: int = 25, offset: int = 0, order_by: str = 'relevance', open_access: bool = True): | ||
url = "https://api.elsevier.com/content/search/sciencedirect" | ||
|
||
headers = { | ||
"Content-Type": "application/json", | ||
"x-els-apikey": ELSEVIER_KEY | ||
} | ||
|
||
data = { | ||
"qs": query, | ||
"filters": { | ||
"openAccess": open_access | ||
}, | ||
"display": { | ||
"offset": offset, | ||
"show": show, | ||
"sortBy": order_by | ||
} | ||
} | ||
|
||
response = requests.put(url, json=data, headers=headers) | ||
|
||
if response.status_code == 200: | ||
response_data = response.json() | ||
|
||
return response_data | ||
else: | ||
print("Request failed with status code:", response.status_code) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.