Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

- Added support for the "legal" service endpoint, providing legal status
information for patents as documented in chapter 3.5 of the OPS v3.2
documentation. Thanks, @MartiONE.

## 4.1.0 (2024-01-25)

- Configure HTTP client to use a network timeout of 10 seconds
Expand Down
34 changes: 34 additions & 0 deletions epo_ops/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Client(object):

__family_path__ = "family"
__images_path__ = "published-data/images"
__legal_path__ = "legal"
__number_path__ = "number-service"
__published_data_path__ = "published-data"
__published_data_search_path__ = "published-data/search"
Expand Down Expand Up @@ -119,6 +120,39 @@ def image(
"""
return self._image_request(path, range, document_format)

def legal(
self,
reference_type: str,
input: Union[Original, Docdb, Epodoc],
) -> requests.Response:
"""
Retrieval service for legal data.

Args:
reference_type (str): Any of "publication", "application", or "priority".
input (Original, Epodoc, or Docdb): The document number as an Original, Epodoc, or Docdb data object.
Returns:
requests.Response: a requests.Response object.

Examples:
>>> response = client.legal("publication", epo_ops.models.Epodoc("EP1000000"))
>>> response
<Response [200]>
>>> "ops:legal" in response.text
True

Note:
This service provides access to legal status information for patents
as documented in chapter 3.5 of the OPS v3.2 documentation.˜
"""

return self._service_request(
dict(
service=self.__legal_path__,
reference_type=reference_type,
input=input,
)
)
def number(
self,
reference_type: str,
Expand Down
5 changes: 5 additions & 0 deletions tests/helpers/api_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ def assert_image_success(client):
assert_request_success(response)
return response

def assert_legal_success(client):
response = client.legal(*data)
assert_request_success(response)
assert "ops:legal" in response.text
return response

def assert_published_data_success(client):
response = client.published_data(*data)
Expand Down
3 changes: 3 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
assert_family_legal_success,
assert_family_success,
assert_image_success,
assert_legal_success,
assert_number_service_success,
assert_published_data_search_success,
assert_published_data_search_with_range_success,
Expand Down Expand Up @@ -44,6 +45,8 @@ def test_family_legal(all_clients):
def test_image(all_clients):
assert_image_success(all_clients)

def test_legal(all_clients):
assert_legal_success(all_clients)

def test_published_data(all_clients):
assert_published_data_success(all_clients)
Expand Down