Skip to content

Commit 39a50c6

Browse files
committed
Merge branch 'dependencies' into deps
2 parents d281902 + 20df993 commit 39a50c6

File tree

7 files changed

+97
-85
lines changed

7 files changed

+97
-85
lines changed

app-auth/graphapponlytutorial/main.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# <ProgramSnippet>
55
import asyncio
66
import configparser
7+
from msgraph.generated.models.o_data_errors.o_data_error import ODataError
78
from graph import Graph
89

910
async def main():
@@ -30,16 +31,21 @@ async def main():
3031
except ValueError:
3132
choice = -1
3233

33-
if choice == 0:
34-
print('Goodbye...')
35-
elif choice == 1:
36-
await display_access_token(graph)
37-
elif choice == 2:
38-
await list_users(graph)
39-
elif choice == 3:
40-
await make_graph_call(graph)
41-
else:
42-
print('Invalid choice!\n')
34+
try:
35+
if choice == 0:
36+
print('Goodbye...')
37+
elif choice == 1:
38+
await display_access_token(graph)
39+
elif choice == 2:
40+
await list_users(graph)
41+
elif choice == 3:
42+
await make_graph_call(graph)
43+
else:
44+
print('Invalid choice!\n')
45+
except ODataError as odata_error:
46+
print('Error:')
47+
if odata_error.error:
48+
print(odata_error.error.code, odata_error.error.message)
4349
# </ProgramSnippet>
4450

4551
# <DisplayAccessTokenSnippet>
@@ -53,7 +59,7 @@ async def list_users(graph: Graph):
5359
users_page = await graph.get_users()
5460

5561
# Output each users's details
56-
if users_page is not None and users_page.value is not None:
62+
if users_page and users_page.value:
5763
for user in users_page.value:
5864
print('User:', user.display_name)
5965
print(' ID:', user.id)

app-auth/graphapponlytutorial/pylintrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,5 +576,5 @@ preferred-modules=
576576

577577
# Exceptions that will emit a warning when being caught. Defaults to
578578
# "BaseException, Exception".
579-
overgeneral-exceptions=BaseException,
580-
Exception
579+
overgeneral-exceptions=builtins.BaseException,
580+
builtins.Exception
Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,45 @@
11
#
2-
# This file is autogenerated by pip-compile with python 3.10
3-
# To update, run:
2+
# This file is autogenerated by pip-compile with Python 3.10
3+
# by the following command:
44
#
55
# pip-compile --output-file=requirements.txt --resolver=backtracking
66
#
7-
aiohttp==3.8.3
7+
aiohttp==3.8.4
88
# via microsoft-kiota-authentication-azure
99
aiosignal==1.3.1
1010
# via aiohttp
11-
anyio==3.6.2
11+
anyio==3.7.0
1212
# via httpcore
1313
async-timeout==4.0.2
1414
# via aiohttp
15-
attrs==22.2.0
15+
attrs==23.1.0
1616
# via aiohttp
17-
azure-core==1.26.2
17+
azure-core==1.27.1
1818
# via
1919
# azure-identity
2020
# microsoft-kiota-authentication-azure
21-
azure-identity==1.12.0
21+
azure-identity==1.13.0
2222
# via
2323
# -r requirements.in
2424
# msgraph-sdk
25-
certifi==2022.12.7
25+
certifi==2023.5.7
2626
# via
2727
# httpcore
2828
# httpx
2929
# requests
3030
cffi==1.15.1
3131
# via cryptography
32-
charset-normalizer==2.1.1
32+
charset-normalizer==3.1.0
3333
# via
3434
# aiohttp
3535
# requests
36-
cryptography==39.0.1
36+
cryptography==41.0.1
3737
# via
3838
# azure-identity
3939
# msal
4040
# pyjwt
41+
exceptiongroup==1.1.1
42+
# via anyio
4143
frozenlist==1.3.3
4244
# via
4345
# aiohttp
@@ -48,9 +50,9 @@ h2==4.1.0
4850
# via httpx
4951
hpack==4.0.0
5052
# via h2
51-
httpcore==0.16.3
53+
httpcore==0.17.2
5254
# via httpx
53-
httpx[http2]==0.23.3
55+
httpx[http2]==0.24.1
5456
# via
5557
# microsoft-kiota-http
5658
# msgraph-core
@@ -59,10 +61,10 @@ hyperframe==6.0.1
5961
idna==3.4
6062
# via
6163
# anyio
64+
# httpx
6265
# requests
63-
# rfc3986
6466
# yarl
65-
microsoft-kiota-abstractions==0.5.0
67+
microsoft-kiota-abstractions==0.5.5
6668
# via
6769
# microsoft-kiota-authentication-azure
6870
# microsoft-kiota-http
@@ -72,19 +74,19 @@ microsoft-kiota-abstractions==0.5.0
7274
# msgraph-sdk
7375
microsoft-kiota-authentication-azure==0.2.0
7476
# via msgraph-sdk
75-
microsoft-kiota-http==0.3.1
77+
microsoft-kiota-http==0.4.4
7678
# via msgraph-core
77-
microsoft-kiota-serialization-json==0.3.1
79+
microsoft-kiota-serialization-json==0.3.6
7880
# via msgraph-sdk
79-
microsoft-kiota-serialization-text==0.2.0
81+
microsoft-kiota-serialization-text==0.2.1
8082
# via msgraph-sdk
81-
msal==1.20.0
83+
msal==1.22.0
8284
# via
8385
# azure-identity
8486
# msal-extensions
8587
msal-extensions==1.0.0
8688
# via azure-identity
87-
msgraph-core==1.0.0a3
89+
msgraph-core==1.0.0a4
8890
# via msgraph-sdk
8991
msgraph-sdk==1.0.0a12
9092
# via -r requirements.in
@@ -96,18 +98,16 @@ portalocker==2.7.0
9698
# via msal-extensions
9799
pycparser==2.21
98100
# via cffi
99-
pyjwt[crypto]==2.6.0
101+
pyjwt[crypto]==2.7.0
100102
# via msal
101103
python-dateutil==2.8.2
102104
# via
103105
# microsoft-kiota-serialization-json
104106
# microsoft-kiota-serialization-text
105-
requests==2.28.2
107+
requests==2.31.0
106108
# via
107109
# azure-core
108110
# msal
109-
rfc3986[idna2008]==1.5.0
110-
# via httpx
111111
six==1.16.0
112112
# via
113113
# azure-core
@@ -118,11 +118,11 @@ sniffio==1.3.0
118118
# anyio
119119
# httpcore
120120
# httpx
121-
typing-extensions==4.4.0
121+
typing-extensions==4.6.3
122122
# via azure-core
123123
uritemplate==4.1.1
124124
# via microsoft-kiota-abstractions
125-
urllib3==1.26.14
125+
urllib3==2.0.3
126126
# via requests
127-
yarl==1.8.2
127+
yarl==1.9.2
128128
# via aiohttp

user-auth/graphtutorial/graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ async def get_inbox(self):
7272
query_parameters= query_params
7373
)
7474

75-
messages = await self.user_client.me.mail_folders_by_id('inbox').messages.get(
75+
messages = await self.user_client.me.mail_folders.by_mail_folder_id('inbox').messages.get(
7676
request_configuration=request_config)
7777
return messages
7878
# </GetInboxSnippet>

user-auth/graphtutorial/main.py

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# <ProgramSnippet>
55
import asyncio
66
import configparser
7+
from msgraph.generated.models.o_data_errors.o_data_error import ODataError
78
from graph import Graph
89

910
async def main():
@@ -33,24 +34,29 @@ async def main():
3334
except ValueError:
3435
choice = -1
3536

36-
if choice == 0:
37-
print('Goodbye...')
38-
elif choice == 1:
39-
await display_access_token(graph)
40-
elif choice == 2:
41-
await list_inbox(graph)
42-
elif choice == 3:
43-
await send_mail(graph)
44-
elif choice == 4:
45-
await make_graph_call(graph)
46-
else:
47-
print('Invalid choice!\n')
37+
try:
38+
if choice == 0:
39+
print('Goodbye...')
40+
elif choice == 1:
41+
await display_access_token(graph)
42+
elif choice == 2:
43+
await list_inbox(graph)
44+
elif choice == 3:
45+
await send_mail(graph)
46+
elif choice == 4:
47+
await make_graph_call(graph)
48+
else:
49+
print('Invalid choice!\n')
50+
except ODataError as odata_error:
51+
print('Error:')
52+
if odata_error.error:
53+
print(odata_error.error.code, odata_error.error.message)
4854
# </ProgramSnippet>
4955

5056
# <GreetUserSnippet>
5157
async def greet_user(graph: Graph):
5258
user = await graph.get_user()
53-
if user is not None:
59+
if user:
5460
print('Hello,', user.display_name)
5561
# For Work/school accounts, email is in mail property
5662
# Personal accounts, email is in userPrincipalName
@@ -66,13 +72,13 @@ async def display_access_token(graph: Graph):
6672
# <ListInboxSnippet>
6773
async def list_inbox(graph: Graph):
6874
message_page = await graph.get_inbox()
69-
if message_page is not None and message_page.value is not None:
75+
if message_page and message_page.value:
7076
# Output each message's details
7177
for message in message_page.value:
7278
print('Message:', message.subject)
7379
if (
74-
message.from_ is not None and
75-
message.from_.email_address is not None
80+
message.from_ and
81+
message.from_.email_address
7682
):
7783
print(' From:', message.from_.email_address.name or 'NONE')
7884
else:
@@ -90,7 +96,7 @@ async def send_mail(graph: Graph):
9096
# Send mail to the signed-in user
9197
# Get the user for their email address
9298
user = await graph.get_user()
93-
if user is not None:
99+
if user:
94100
user_email = user.mail or user.user_principal_name
95101

96102
await graph.send_mail('Testing Microsoft Graph', 'Hello world!', user_email or '')

user-auth/graphtutorial/pylintrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,5 +576,5 @@ preferred-modules=
576576

577577
# Exceptions that will emit a warning when being caught. Defaults to
578578
# "BaseException, Exception".
579-
overgeneral-exceptions=BaseException,
580-
Exception
579+
overgeneral-exceptions=builtins.BaseException,
580+
builtins.Exception

0 commit comments

Comments
 (0)