Skip to content

Commit baf8045

Browse files
MartiONEamotl
authored andcommitted
Add support for the "legal" service endpoint
It provides legal status information for patents as documented in chapter 3.5 of the OPS v3.2 documentation.
1 parent 6040928 commit baf8045

4 files changed

Lines changed: 46 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
- Added support for the "legal" service endpoint, providing legal status
4+
information for patents as documented in chapter 3.5 of the OPS v3.2
5+
documentation. Thanks, @MartiONE.
6+
37
## 4.1.0 (2024-01-25)
48

59
- Configure HTTP client to use a network timeout of 10 seconds

epo_ops/api.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class Client(object):
2828

2929
__family_path__ = "family"
3030
__images_path__ = "published-data/images"
31+
__legal_path__ = "legal"
3132
__number_path__ = "number-service"
3233
__published_data_path__ = "published-data"
3334
__published_data_search_path__ = "published-data/search"
@@ -119,6 +120,39 @@ def image(
119120
"""
120121
return self._image_request(path, range, document_format)
121122

123+
def legal(
124+
self,
125+
reference_type: str,
126+
input: Union[Original, Docdb, Epodoc],
127+
) -> requests.Response:
128+
"""
129+
Retrieval service for legal data.
130+
131+
Args:
132+
reference_type (str): Any of "publication", "application", or "priority".
133+
input (Original, Epodoc, or Docdb): The document number as an Original, Epodoc, or Docdb data object.
134+
Returns:
135+
requests.Response: a requests.Response object.
136+
137+
Examples:
138+
>>> response = client.legal("publication", epo_ops.models.Epodoc("EP1000000"))
139+
>>> response
140+
<Response [200]>
141+
>>> "ops:legal" in response.text
142+
True
143+
144+
Note:
145+
This service provides access to legal status information for patents
146+
as documented in chapter 3.5 of the OPS v3.2 documentation.˜
147+
"""
148+
149+
return self._service_request(
150+
dict(
151+
service=self.__legal_path__,
152+
reference_type=reference_type,
153+
input=input,
154+
)
155+
)
122156
def number(
123157
self,
124158
reference_type: str,

tests/helpers/api_helpers.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ def assert_image_success(client):
4848
assert_request_success(response)
4949
return response
5050

51+
def assert_legal_success(client):
52+
response = client.legal(*data)
53+
assert_request_success(response)
54+
assert "ops:legal" in response.text
55+
return response
5156

5257
def assert_published_data_success(client):
5358
response = client.published_data(*data)

tests/test_api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
assert_family_legal_success,
1313
assert_family_success,
1414
assert_image_success,
15+
assert_legal_success,
1516
assert_number_service_success,
1617
assert_published_data_search_success,
1718
assert_published_data_search_with_range_success,
@@ -44,6 +45,8 @@ def test_family_legal(all_clients):
4445
def test_image(all_clients):
4546
assert_image_success(all_clients)
4647

48+
def test_legal(all_clients):
49+
assert_legal_success(all_clients)
4750

4851
def test_published_data(all_clients):
4952
assert_published_data_success(all_clients)

0 commit comments

Comments
 (0)