|
11 | 11 | server, and the PageResult class to represent the pages. |
12 | 12 |
|
13 | 13 | This module also imports the necessary types and exceptions from the |
14 | | -typing, requests.exceptions, kiota_http.httpx_request_adapter, |
| 14 | +typing, kiota_http.httpx_request_adapter, |
15 | 15 | kiota_abstractions.method, kiota_abstractions.headers_collection, |
16 | 16 | kiota_abstractions.request_information, kiota_abstractions.serialization.parsable, |
17 | 17 | and models modules. |
|
25 | 25 | from kiota_abstractions.request_adapter import RequestAdapter |
26 | 26 | from kiota_abstractions.request_information import RequestInformation |
27 | 27 | from kiota_abstractions.serialization import Parsable, ParsableFactory |
28 | | -from requests.exceptions import InvalidURL |
29 | 28 |
|
30 | 29 | from msgraph_core.models.page_result import ( |
31 | 30 | PageResult, # pylint: disable=no-name-in-module, import-error |
@@ -201,6 +200,9 @@ async def fetch_next_page(self) -> Optional[Union[T, PageResult]]: |
201 | 200 | if not next_link: |
202 | 201 | raise ValueError('The response does not contain a nextLink.') |
203 | 202 | if not next_link.startswith('http'): |
| 203 | + # Imported lazily: importing requests at module level adds ~350 ms |
| 204 | + # to every `from msgraph import GraphServiceClient` cold start. |
| 205 | + from requests.exceptions import InvalidURL # pylint: disable=import-outside-toplevel |
204 | 206 | raise InvalidURL('Could not parse nextLink URL.') |
205 | 207 | request_info = RequestInformation() |
206 | 208 | request_info.http_method = Method.GET |
|
0 commit comments