我只想找到使用Python和Google专利检索API的专利所有人。
import urllib2
import json
url = ('https://ajax.googleapis.com/ajax/services/search/patent?' +
'v=1.0&q=barack%20obama')
request = urllib2.Request(url, None, {})
response = urllib2.urlopen(request)
# Process the JSON string.
print json.load(response)
# now have some fun with the results...
这个结果并没有告诉受让人。我怎么能得到它?
答案 0 :(得分:1)
不推荐使用Google专利API(" The Google Patent Search API has been officially deprecated as of May 26, 2011.")。我不认为你获得的数据是可靠的。
我不确定Google的服务条款是否允许针对单个Google专利页面,但一种策略可能是使用搜索来获取结果列表,然后使用类似Beautiful Soup的内容进行解析每个结果。
示例:
import urllib2
import json
from bs4 import BeautifulSoup
url = ('https://ajax.googleapis.com/ajax/services/search/patent?' +
'v=1.0&q=barack%20obama')
request = urllib2.Request(url, None, {})
response = urllib2.urlopen(request)
jsonResponse = json.load(response)
responseData=jsonResponse['responseData']
results = responseData["results"]
print "This doesn't work, no assignee data..."
for result in results:
print "patent no.: ", result["patentNumber"]
print "assignee: ", result["assignee"]
print " "
print "...but this seems to."
for result in results:
URL = "https://www.google.com/patents/"+result["patentNumber"]
req = urllib2.Request(URL, headers={'User-Agent' : "python"})
_file = urllib2.urlopen(req)
patent_html = _file.read()
soup = BeautifulSoup(patent_html, 'html.parser')
patentNumber = soup.find("span", { "class" : "patent-number" }).text
assigneeMetaTag = soup.find("meta", { "scheme" : "assignee"})
patentAssignee = assigneeMetaTag.attrs["content"]
print "patent no.: ", patentNumber
print "assignee: ", patentAssignee
print " "
对我来说,打印出来:
This doesn't work, no assignee data...
patent no.: US20110022394
assignee:
patent no.: US20140089323
assignee:
patent no.: US8117227
assignee:
patent no.: CA2702937C
assignee:
...but this seems to.
patent no.: US 20110022394 A1
assignee: Thomas Wide
patent no.: US 20140089323 A1
assignee: Appinions Inc.
patent no.: US 8117227 B2
assignee: Scuola Normale Superiore Di Pisa
patent no.: CA 2702937 C
assignee: Neil S. Roseman
请注意,我相信您只是在专利发布之日才能获得受让人;在转让的情况下,不是现任受让人。
答案 1 :(得分:1)
正如编码gatty所说,Google专利API已经被删除,并且它可能不稳定。如果您正在通过RESTful API端点查找专利数据,IP Street是正确的方法。它非常直接,您可以立即启动并运行。
要查找专利所有者,请在POST
的查询中https://api.ipstreet.com/v1/data/patent
申请专利号。
这是python 3.X中的一个例子:
import requests
import json
def search_by_patent_number(input):
"""Takes one or more patent numbers and returns a patent data json object"""
endpoint = 'https://api.ipstreet.com/v1/data/patent'
headers = {'x-api-key': "YOUR-API-KEY"}
payload = json.dumps({'q': {'patent_number': input}})
r = requests.post(url=endpoint, headers=headers, data=payload)
print(r.text)
return r.json()
if __name__ == '__main__':
response = search_by_patent_number(['8541236','7653452'])
for asset in response['Assets']:
print(asset['application_date'])
您可以在IP Street Github repo中找到更多代码示例:https://github.com/IPStreet/HelloWorld
以下是他们的开发者文档页面:http://www.ipstreet.com/
答案 2 :(得分:0)
前一段时间,我也在使用Google专利搜索API。它消失了。前面提到的ipstreet API也是如此。
但是我确实发现了https://www.patentsview.org/,它似乎拥有USPTO的祝福和完善的API。对于初学者,请看一下:
https://www.patentsview.org/api/query-language.html
现在,我正在更新解析器以使用它。