Researching patents for the first time & having difficulty extracting patent claims & descriptions. My query returns null for these 2 fields. All other fields are fine. Any insight what I am doing incorrectly?
import requests
import json
Read the API key from the file
with open("lensapikey.txt", "r") as file:
api_key = file.read().strip()
Hi -
Researching patents for the first time & having difficulty extracting patent claims & descriptions. My query returns null for these 2 fields. All other fields are fine. Any insight what I am doing incorrectly?
import requests import json
Read the API key from the file
with open("lensapikey.txt", "r") as file: api_key = file.read().strip()
Define the API endpoint
api_url = "https://api.lens.org/patent/search"
Define the search query and parameters
search_query = { "query": { "multi_match": { "query": "glucose", "fields": ["biblio.invention_title^3", "abstract", "description", "claims"] } }, "size": 5, "from": 0, "include": [ "biblio.invention_title", "biblio.application_reference", "biblio.priority_claims", "legal_status", "claims", "abstract", "description" ], "sort": [ { "created": "desc" }, { "year_published": "asc" } ], "exclude": None, "scroll": None, "scroll_id": None }
print("Starting API call...")
Make the API call
headers = { "Authorization": f"Bearer {api_key}", "Content-Type": "application/json" } response = requests.post(api_url, headers=headers, json=search_query)
Check if the request was successful
if response.status_code == 200: print("API call successful. Parsing and printing results...")
else: print(f"Error: {response.status_code}") print(f"Response content: {response.content}")