ip-tools / python-epo-ops-client

Python client for EPO OPS, the European Patent Office's Open Patent Services API.
Apache License 2.0
146 stars 59 forks source link

`client.image` Method Fails to Retrieve Specific Document Pages #107

Open sonofhypnos opened 8 months ago

sonofhypnos commented 8 months ago

Issue: Using client.image to fetch pages from EPO's API always returns the first page, regardless of the range parameter provided.

Steps to Reproduce:

  1. Used client.image with range=page to fetch the nth page of a document.
  2. Only the first page was returned in every attempt.

Workaround: Manually constructing the URL and headers to specify the X-OPS-Range and making a direct request with client._make_request retrieves the correct page.

Expected: client.image should interpret the range parameter to fetch the specified page number.

Actual: Always retrieves the first page.

Details:

Make the request using client._make_request, specifying the Range through parameters and headers

image_response = client._make_request( url, data="", params={"Range": page}, extra_headers={"Accept": "application/pdf", "X-OPS-Range": str(page)}, use_get=True )



(I found the above through trial and error, because I couldn't understand what the data parameter does here)