Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Google patent api

I simply want to find out the owner of a patent using Python and the Google patent search 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...

This result does not tell about assignee. How can I get it?

like image 658
Deepak Ingole Avatar asked Sep 17 '15 18:09

Deepak Ingole


1 Answers

The Google patents API is deprecated ("The Google Patent Search API has been officially deprecated as of May 26, 2011."). I don't think the data you get is reliable.

I'm not sure whether the Google terms of service allows going against individual Google patent pages, but one strategy might be to use search to get a list of results, then use something like Beautiful Soup to parse each result.

Example:

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 " "

For me this prints out:

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

One note of caution, I believe you're only going to get the assignee as of the date the patent was issued; not the current assignee, in cases where it has been transferred.

like image 159
codingatty Avatar answered Oct 21 '22 16:10

codingatty