-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b2dff0
commit 508151b
Showing
6 changed files
with
36 additions
and
40 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,2 +1,2 @@ | ||
GOOGLE_API_KEY = | ||
GOOGLE_CSE_ID = | ||
BING_SEARCH_KEY = | ||
BING_ENDPOINT = |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
import os | ||
from pprint import pprint | ||
import requests | ||
from dotenv import load_dotenv | ||
import os | ||
|
||
def search_bing_urls(query: str, num_results: int = 100) -> list[str]: | ||
load_dotenv() | ||
urls = [] | ||
endpoint = os.getenv("BING_ENDPOINT") + "/v7.0/search" | ||
subscription_key = os.getenv("BING_SEARCH_KEY") | ||
mkt = 'en-US' | ||
params = { 'q': query, 'mkt': mkt, 'count': 50 } | ||
headers = { 'Ocp-Apim-Subscription-Key': subscription_key } | ||
# Call the API | ||
try: | ||
response = requests.get(endpoint, headers=headers, params=params) | ||
response.raise_for_status() | ||
|
||
print("\nHeaders:\n") | ||
print(response.headers) | ||
|
||
print("\nJSON Response:\n") | ||
pprint(response.json()) | ||
|
||
except Exception as ex: | ||
raise ex |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
locust | ||
regex | ||
google-api-python-client | ||
python-dotenv |
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