forked from 0xWheatyz/SPARC
chore: include local files
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,7 @@
|
|||||||
|
# Handle all of the configurations and secrets
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
|
||||||
|
load_dotenv()
|
||||||
|
api_key = os.getenv("API_KEY")
|
||||||
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import serpapi
|
||||||
|
from SPARC import config
|
||||||
|
|
||||||
|
class SERP:
|
||||||
|
def query(company: str):
|
||||||
|
# Make API call
|
||||||
|
params = {
|
||||||
|
"engine": "google_patents",
|
||||||
|
"q": company,
|
||||||
|
"num": 10,
|
||||||
|
"filter": 1,
|
||||||
|
"tbs": "cdr:1,cd_min:10/28/2025,cd_max:11/4/2025",
|
||||||
|
"api_key": config.api_key,
|
||||||
|
}
|
||||||
|
search = serpapi.search(params)
|
||||||
|
# Convert data into a list of publicationID
|
||||||
|
patent_ids = []
|
||||||
|
list_of_patents = search["organic_results"]
|
||||||
|
for patent in list_of_patents:
|
||||||
|
patent_ids.append(patent["publication_number"])
|
||||||
|
|
||||||
|
return patent_ids
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import SPARC.serp_api
|
||||||
|
|
||||||
|
a = SPARC.serp_api.SERP.query('nvidia')
|
||||||
|
|
||||||
|
print(a)
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
dotenv
|
||||||
|
serpapi
|
||||||
Reference in New Issue
Block a user