Response
The response module offers a structured representation of responses from OAI-PMH services.
This module defines the OAIResponse class, which encapsulates the HTTP response from an OAI-PMH server, providing easy access to its content both as raw text and as parsed XML. It is designed to work seamlessly with various components of an OAI-PMH client, handling the nuances of OAI-PMH responses.
OAIResponse
dataclass
Represents a response received from an OAI server, encapsulating the raw HTTP response and parsed XML content.
This class provides a structured way to access various aspects of an OAI server's response. It offers methods to retrieve the raw text of the response, parse it as XML, and obtain a string representation of the response that includes the OAI verb.
Attributes:
Name | Type | Description |
---|---|---|
http_response |
Response
|
The original HTTP response object from the OAI server. |
params |
dict[str, str]
|
A dictionary of the OAI parameters used in the request that led to this response. |
Source code in src/oaipmh_scythe/response.py
raw: str
property
Return the raw text of the server's response as a unicode string.
xml: etree._Element
property
Parse the server's response content and return it as an etree._Element
object.