Skip to content

Open Policy Finder

The OpenPolicyFinder client (bibliofabric.openpolicyfinder) reads the Jisc Open Policy Finder API: funders, funder groups, publishers, publisher policies, journals, and the OpenDOAR directory of open access repositories, which the same API serves as the repository item type. Calls return typed Pydantic models through an async client and a generated sync twin.

Credentials

Every route needs an API key. Request one from Jisc and set OPENPOLICYFINDER_API_KEY in the environment or a .env file, or pass api_key= to the client. The key travels in the x-api-key header and is redacted from logs and error strings. Jisc publishes no request-rate budget, so the client keeps the core defaults; tune them with OPENPOLICYFINDER_MAX_REQUESTS_PER_SECOND and OPENPOLICYFINDER_MAX_CONCURRENCY. The constructor also takes a keyword-only mailto= contact address that appears in the User-Agent.

The data is licensed CC BY-NC-ND 4.0, so Jisc scopes the API to non-commercial use; contact Jisc when unsure about a reuse.

No live API check ran while building this client: every Open Policy Finder route rejects unauthenticated calls, and no key was available. The behavior below and in upstream quirks comes from the published developer documentation and metadata schema, not from live responses.

Quick start

import asyncio

from bibliofabric.openpolicyfinder import OpenPolicyFinderClient


async def main() -> None:
    async with OpenPolicyFinderClient() as client:
        # Journals: get() takes the numeric id or an ISSN.
        journal = await client.journals.get("1097-0142")
        print(journal.title[0].title, [entry.issn for entry in journal.issns])

        page = await client.policies.search(
            filters={"internal_moniker_word": "subscription"}, page_size=5
        )
        print(page.total, "publisher policies match")
        for record in page.results:
            print(record.id, record.internal_moniker)

        page = await client.repositories.search(
            filters={"name_word": "warwick", "country": "gb"}
        )
        for record in page.results:
            print(record.name[0].name, record.url)


asyncio.run(main())

A page carries total from totalHits and next_cursor from next_search_after. iterate() walks deep result sets through the search_after token once the offset window of 10000 records ends:

async for record in client.publishers.iterate(limit=500):
    print(record.id, record.name[0].name)

Sync quick start

from bibliofabric.openpolicyfinder import OpenPolicyFinderSyncClient

with OpenPolicyFinderSyncClient() as client:
    record = client.funders.get(57)
    print(record.name[0].name)

The id directory

/object_ids answers CSV rows of id and date_modified per item type. The client parses them into ObjectIdEntry records; iterate() walks the directory by the id of the last row, which is how the route pages past the offset window:

entries = await client.object_ids.entries("publication", limit=1000)
async for entry in client.object_ids.iterate("repository"):
    print(entry.id, entry.date_modified)

What the client covers

  • client.funders, client.funder_groups, client.publishers, client.policies, client.journals, client.repositories: the JSON records of /retrieve and /retrieve_by_id, with get, exists, search, iterate, collect, first, and count.
  • client.object_ids: the CSV id directory, with entries and iterate.
  • Filter models per item type: FunderFilters, PublisherFilters, PublisherPolicyFilters, PublicationFilters, RepositoryFilters. The API documents no filter fields for funder groups.

Write routes do not exist on this API. See upstream quirks for the details that shape the models, and the API reference for the full surface.