Skip to content
Snippets Groups Projects
Commit a5f2ded9 authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

remove obsolete web services from ws client module

parent c326fcf5
No related branches found
No related tags found
1 merge request!13Master
......@@ -77,85 +77,6 @@ def get_pubmed_info(pmid):
}
def get_epo_info(patent_number):
"""
Retrieve information about a patent using the EPO website
WARNING: this is not to be used anymore, the 3.1 version of the EPO service is now
offline
:param patent_number: patent number
:type patent_number: str
:return: patent metadata (title, journal name, publication year, authors list).
:rtype: dict
"""
resp = requests.get(
f"http://ops.epo.org/3.1/rest-services/published-data/publication/docdb/"
f"{patent_number}/biblio.json"
)
data = resp.json()
exchange_doc = data["ops:world-patent-data"]["exchange-documents"][
"exchange-document"
]
if isinstance(exchange_doc, list):
exchange_doc = exchange_doc[0]
title = [
el["$"]
for el in exchange_doc["bibliographic-data"]["invention-title"]
if el["@lang"] == "en"
][0]
authors = [
i["inventor-name"]["name"]["$"]
for i in exchange_doc["bibliographic-data"]["parties"]["inventors"]["inventor"]
if i["@data-format"] == "original"
][0]
biblio_year = [
el["date"]["$"][:4]
for el in exchange_doc["bibliographic-data"]["publication-reference"][
"document-id"
]
if el["@document-id-type"] == "epodoc"
][0]
return {
"title": title,
"journal_name": None,
"biblio_year": biblio_year,
"authors_list": authors,
}
def get_google_patent_info_ris(patent_number):
"""
Retrieve information about a patent using the Google RIS web service
WARNING: this is not to be used anymore, this Google Web service is now offline
:param patent_number: patent number
:type patent_number: str
:return: patent metadata (title, journal name, publication year, authors list).
:rtype: dict
"""
url = "https://encrypted.google.com/patents/{}.ris".format(patent_number)
resp = requests.get(url)
title = None
authors = []
biblio_year = None
for line_str in resp.text.split("\n"):
line = line_str.strip().split(" - ")
if line[0] == "A1":
authors.append(line[1])
elif line[0] == "T1":
title = line[1]
elif line[0] == "Y1":
biblio_year = line[1].split("/")[0]
return {
"title": title,
"journal_name": None,
"biblio_year": biblio_year,
"authors_list": authors,
}
def get_google_patent_info(patent_number):
"""
Retrieve information about a patent parsing Dublin Core info in the Google HTML
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment