Skip to content

Commit 56f6951

Browse files
authored
Merge pull request #689 from microsoftgraph/fix/abstract-request-adapter
fix: Use abstractions request adapter in tasks
2 parents af7360b + 6d390a2 commit 56f6951

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/msgraph_core/tasks/page_iterator.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
"""
2-
This module contains the PageIterator class which is used to
2+
This module contains the PageIterator class which is used to
33
iterate over paged responses from a server.
44
5-
The PageIterator class provides methods to iterate over the items
5+
The PageIterator class provides methods to iterate over the items
66
in the pages, fetch the next page, convert a response to a page, and
77
fetch the next page from the server.
88
99
The PageIterator class uses the Parsable interface to parse the responses
10-
from the server, the HttpxRequestAdapter class to send requests to the
10+
from the server, the RequestAdapter class to send requests to the
1111
server, and the PageResult class to represent the pages.
1212
13-
This module also imports the necessary types and exceptions from the
13+
This module also imports the necessary types and exceptions from the
1414
typing, requests.exceptions, kiota_http.httpx_request_adapter,
15-
kiota_abstractions.method, kiota_abstractions.headers_collection,
15+
kiota_abstractions.method, kiota_abstractions.headers_collection,
1616
kiota_abstractions.request_information, kiota_abstractions.serialization.parsable,
1717
and models modules.
1818
"""
@@ -22,7 +22,7 @@
2222
from typing import TypeVar
2323
from requests.exceptions import InvalidURL
2424

25-
from kiota_http.httpx_request_adapter import HttpxRequestAdapter
25+
from kiota_abstractions.request_adapter import RequestAdapter
2626
from kiota_abstractions.method import Method
2727
from kiota_abstractions.headers_collection import HeadersCollection
2828
from kiota_abstractions.request_information import RequestInformation
@@ -41,7 +41,7 @@ class PageIterator:
4141
fetch the next page, and convert a response to a page.
4242
4343
Attributes:
44-
request_adapter (HttpxRequestAdapter): The adapter used to send HTTP requests.
44+
request_adapter (RequestAdapter): The adapter used to send HTTP requests.
4545
pause_index (int): The index at which to pause iteration.
4646
headers (HeadersCollection): The headers to include in the HTTP requests.
4747
request_options (list): The options for the HTTP requests.
@@ -50,15 +50,15 @@ class PageIterator:
5050
has_next (bool): Whether there are more pages to fetch.
5151
5252
Methods:
53-
__init__(response: Union[T, list, object], request_adapter: HttpxRequestAdapter,
54-
constructor_callable: Optional[Callable] = None): Initializes a new instance of
53+
__init__(response: Union[T, list, object], request_adapter: RequestAdapter,
54+
constructor_callable: Optional[Callable] = None): Initializes a new instance of
5555
the PageIterator class.
5656
"""
5757

5858
def __init__(
5959
self,
6060
response: Union[T, list, object],
61-
request_adapter: HttpxRequestAdapter,
61+
request_adapter: RequestAdapter,
6262
constructor_callable: Optional[Callable] = None
6363
):
6464
self.request_adapter = request_adapter
@@ -96,7 +96,7 @@ def set_headers(self, headers: dict) -> HeadersCollection:
9696
This method takes a dictionary of headers and adds them to the
9797
existing headers.
9898
Args:
99-
headers (dict): A dictionary of headers to add. The keys are the
99+
headers (dict): A dictionary of headers to add. The keys are the
100100
header names and the values are the header values.
101101
"""
102102
self.headers.add_all(**headers)
@@ -123,7 +123,7 @@ async def iterate(self, callback: Callable) -> None:
123123
The iteration stops when there are no more pages or the callback
124124
function returns False.
125125
Args:
126-
callback (Callable): The function to apply to each item.
126+
callback (Callable): The function to apply to each item.
127127
It should take one argument (the item) and return a boolean.
128128
"""
129129
while True:
@@ -152,7 +152,7 @@ async def next(self) -> Optional[PageResult]:
152152
def convert_to_page(response: Union[T, list, object]) -> PageResult:
153153
"""
154154
Converts a response to a PageResult.
155-
This method extracts the 'value' and 'odata_next_link' from the
155+
This method extracts the 'value' and 'odata_next_link' from the
156156
response and uses them to create a PageResult.
157157
Args:
158158
response (Union[T, list, object]): The response to convert. It can

0 commit comments

Comments
 (0)