Skip to content

Commit 644bfe1

Browse files
authored
Merge branch 'dev' into feat/request-context
2 parents 19bf0f9 + a4ff042 commit 644bfe1

File tree

6 files changed

+123
-5
lines changed

6 files changed

+123
-5
lines changed

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @samwelkanda @jobala @ddyett @MichaelMainer @shemogumbe

.github/ISSUE_TEMPLATE/bug_report.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: samwelkanda
7+
8+
---
9+
10+
---
11+
name: Bug report
12+
about: Create a report to help us improve
13+
title: ''
14+
labels: ''
15+
assignees: ''
16+
17+
---
18+
19+
**Describe the bug**
20+
A clear and concise description of what the bug is.
21+
22+
**To Reproduce**
23+
Steps to reproduce the behavior:
24+
1. Go to '...'
25+
2. Click on '....'
26+
3. Scroll down to '....'
27+
4. See error
28+
29+
**Expected behavior**
30+
A clear and concise description of what you expected to happen.
31+
32+
**Screenshots**
33+
If applicable, add screenshots to help explain your problem.
34+
35+
**Additional context**
36+
Add any other context about the problem here.
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/pull_request_template.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Overview
2+
3+
Brief description of what this PR does, and why it is needed.
4+
5+
### Demo
6+
7+
Optional. Screenshots, `curl` examples, etc.
8+
9+
### Notes
10+
11+
Optional. Ancillary topics, caveats, alternative strategies that didn't work out, anything else.
12+
13+
## Testing Instructions
14+
15+
* How to test this PR
16+
* Prefer bulleted description
17+
* Start after checking out this branch
18+
* Include any setup required, such as bundling scripts, restarting services, etc.
19+
* Include test case, and expected output

msgraphcore/client_factory.py

+27-4
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,23 @@
1111

1212

1313
class HTTPClientFactory:
14-
"""
15-
Constructs HTTP Client(session) instances configured with either custom or default
14+
"""Constructs native HTTP Client(session) instances configured with either custom or default
1615
pipeline of middleware.
16+
17+
:func: Class constructor accepts a user provided session object and kwargs to configure the
18+
request handling behaviour of the client
19+
:keyword enum api_version: The Microsoft Graph API version to be used, for example
20+
`APIVersion.v1` (default). This value is used in setting the base url for all requests for
21+
that session.
22+
:class:`~msgraphcore.enums.APIVersion` defines valid API versions.
23+
:keyword enum cloud: a supported Microsoft Graph cloud endpoint.
24+
Defaults to `NationalClouds.Global`
25+
:class:`~msgraphcore.enums.NationalClouds` defines supported sovereign clouds.
26+
:keyword tuple timeout: Default connection and read timeout values for all session requests.
27+
Specify a tuple in the form of Tuple(connect_timeout, read_timeout) if you would like to set
28+
the values separately. If you specify a single value for the timeout, the timeout value will
29+
be applied to both the connect and the read timeouts.
30+
:keyword obj session: A custom Session instance from the python requests library
1731
"""
1832
def __init__(self, **kwargs):
1933
"""Class constructor that accepts a user provided session object and kwargs
@@ -27,15 +41,24 @@ def __init__(self, **kwargs):
2741
self._set_default_timeout()
2842

2943
def create_with_default_middleware(self, credential: TokenCredential, **kwargs) -> Session:
30-
"""Applies the default middleware chain to the HTTP Client"""
44+
"""Applies the default middleware chain to the HTTP Client
45+
46+
:param credential: TokenCredential used to acquire an access token for the Microsoft
47+
Graph API. Created through one of the credential classes from `azure.identity`
48+
"""
3149
middleware = [
3250
AuthorizationHandler(credential, **kwargs),
3351
]
3452
self._register(middleware)
3553
return self.session
3654

3755
def create_with_custom_middleware(self, middleware: [BaseMiddleware]) -> Session:
38-
"""Applies a custom middleware chain to the HTTP Client """
56+
"""Applies a custom middleware chain to the HTTP Client
57+
58+
:param list middleware: Custom middleware(HTTPAdapter) list that will be used to create
59+
a middleware pipeline. The middleware should be arranged in the order in which they will
60+
modify the request.
61+
"""
3962
if not middleware:
4063
raise ValueError("Please provide a list of custom middleware")
4164
self._register(middleware)

msgraphcore/graph_client.py

+20-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,26 @@ def wrapper(*args, **kwargs):
3131

3232

3333
class GraphClient:
34-
"""Constructs a custom HTTPClient to be used for requests against Microsoft Graph"""
34+
"""Constructs a custom HTTPClient to be used for requests against Microsoft Graph
35+
36+
:keyword credential: TokenCredential used to acquire an access token for the Microsoft
37+
Graph API. Created through one of the credential classes from `azure.identity`
38+
:keyword list middleware: Custom middleware(HTTPAdapter) list that will be used to create
39+
a middleware pipeline. The middleware should be arranged in the order in which they will
40+
modify the request.
41+
:keyword enum api_version: The Microsoft Graph API version to be used, for example
42+
`APIVersion.v1` (default). This value is used in setting the base url for all requests for
43+
that session.
44+
:class:`~msgraphcore.enums.APIVersion` defines valid API versions.
45+
:keyword enum cloud: a supported Microsoft Graph cloud endpoint.
46+
Defaults to `NationalClouds.Global`
47+
:class:`~msgraphcore.enums.NationalClouds` defines supported sovereign clouds.
48+
:keyword tuple timeout: Default connection and read timeout values for all session requests.
49+
Specify a tuple in the form of Tuple(connect_timeout, read_timeout) if you would like to set
50+
the values separately. If you specify a single value for the timeout, the timeout value will
51+
be applied to both the connect and the read timeouts.
52+
:keyword obj session: A custom Session instance from the python requests library
53+
"""
3554
__instance = None
3655

3756
def __new__(cls, *args, **kwargs):

0 commit comments

Comments
 (0)