chore: include local files
This commit is contained in:
parent
60a2b82510
commit
8ca435a78a
0
SPARC/__init__.py
Normal file
0
SPARC/__init__.py
Normal file
BIN
SPARC/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
SPARC/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
BIN
SPARC/__pycache__/config.cpython-312.pyc
Normal file
BIN
SPARC/__pycache__/config.cpython-312.pyc
Normal file
Binary file not shown.
BIN
SPARC/__pycache__/serp_api.cpython-312.pyc
Normal file
BIN
SPARC/__pycache__/serp_api.cpython-312.pyc
Normal file
Binary file not shown.
7
SPARC/config.py
Normal file
7
SPARC/config.py
Normal file
@ -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
SPARC/patent_api.py
Normal file
0
SPARC/patent_api.py
Normal file
22
SPARC/serp_api.py
Normal file
22
SPARC/serp_api.py
Normal file
@ -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
|
||||
5
main.py
Normal file
5
main.py
Normal file
@ -0,0 +1,5 @@
|
||||
import SPARC.serp_api
|
||||
|
||||
a = SPARC.serp_api.SERP.query('nvidia')
|
||||
|
||||
print(a)
|
||||
2
requirements.txt
Normal file
2
requirements.txt
Normal file
@ -0,0 +1,2 @@
|
||||
dotenv
|
||||
serpapi
|
||||
Loading…
Reference in New Issue
Block a user