class SharePointRequest
SharePointRequest is a specialized OData request class configured to use JSON Light format for SharePoint API interactions.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/request.py
5 - 7
simple
Purpose
This class serves as a request handler specifically designed for SharePoint operations. It extends ODataRequest and pre-configures it with JsonLightFormat (OData v3 JSON Light protocol) to handle communication with SharePoint REST APIs. The class provides a standardized way to construct and execute HTTP requests to SharePoint services using the OData protocol with JSON Light serialization.
Source Code
class SharePointRequest(ODataRequest):
def __init__(self):
super().__init__(JsonLightFormat())
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
ODataRequest | - |
Parameter Details
__init__: The constructor takes no parameters. It automatically initializes the parent ODataRequest class with JsonLightFormat() as the data format handler, setting up the request to use OData v3 JSON Light protocol for SharePoint communication.
Return Value
Instantiation returns a SharePointRequest object that is pre-configured with JSON Light formatting capabilities. The object inherits all methods and properties from ODataRequest, allowing it to build, execute, and process HTTP requests to SharePoint endpoints. Methods inherited from the parent class typically return response objects, query results, or modified request instances depending on the operation.
Class Interface
Methods
__init__(self) -> None
Purpose: Initializes the SharePointRequest with JSON Light format for OData v3 protocol
Returns: None - constructor initializes the instance
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
format |
JsonLightFormat | The data format handler inherited from ODataRequest, set to JsonLightFormat for SharePoint compatibility | instance |
Dependencies
office365
Required Imports
from office365.runtime.odata.request import ODataRequest
from office365.runtime.odata.v3.json_light_format import JsonLightFormat
Usage Example
from office365.runtime.odata.request import ODataRequest
from office365.runtime.odata.v3.json_light_format import JsonLightFormat
class SharePointRequest(ODataRequest):
def __init__(self):
super().__init__(JsonLightFormat())
# Instantiate the request handler
request = SharePointRequest()
# The request object is now ready to be used with SharePoint context
# Typically used internally by SharePoint client context:
# from office365.sharepoint.client_context import ClientContext
# ctx = ClientContext(site_url).with_credentials(credentials)
# The context uses SharePointRequest internally for API calls
Best Practices
- This class is typically instantiated internally by SharePoint client libraries rather than directly by end users
- The class automatically configures JSON Light format, which is the standard for SharePoint OData v3 APIs
- When extending this class, ensure compatibility with SharePoint's OData implementation
- The parent ODataRequest class handles the actual HTTP communication, so this class focuses on format configuration
- Use this class as part of a larger SharePoint client context rather than standalone
- Ensure proper authentication is configured at the context level before making requests
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class ODataRequest 72.6% similar
-
class SharingInformationRequest 69.1% similar
-
class ShareLinkRequest 65.4% similar
-
class SharePointRestClient 65.1% similar
-
class SearchRequest 65.0% similar