File tree Expand file tree Collapse file tree 3 files changed +80
-1
lines changed Expand file tree Collapse file tree 3 files changed +80
-1
lines changed Original file line number Diff line number Diff line change @@ -46,4 +46,7 @@ Use a library like [MSAL](https://pypi.org/project/msal/) or [Azure Identity](ht
46
46
```
47
47
pip install -e .[tests]
48
48
pytest # run unit tests
49
- ```
49
+ ```
50
+
51
+ ## Deployment
52
+ Bump the version in ` pyproject.toml ` and ` src/msdrive/__init__.py ` and then run the ` Upload Python Package ` pipeline.
Original file line number Diff line number Diff line change
1
+ from msdrive import OneDrive
2
+ from msdrive .exceptions import (
3
+ DriveException ,
4
+ InvalidAccessToken ,
5
+ ItemNotFound ,
6
+ RateLimited ,
7
+ )
8
+
9
+ # Catch generic errors
10
+ try :
11
+ drive = OneDrive ("access_token_here" )
12
+ drive .list_items ()
13
+ except DriveException as err :
14
+ print ("Something went wrong:" , err )
15
+
16
+
17
+ # Catch invalid access token
18
+ try :
19
+ drive = OneDrive ("access_token_here" )
20
+ drive .list_items ()
21
+ except InvalidAccessToken as err :
22
+ print ("Invalid access token:" , err )
23
+
24
+
25
+ # Catch item not found
26
+ try :
27
+ drive = OneDrive ("access_token_here" )
28
+ drive .list_items ()
29
+ except ItemNotFound as err :
30
+ print ("Item not found:" , err )
31
+
32
+
33
+ # Catch rate limit exceeded
34
+ try :
35
+ drive = OneDrive ("access_token_here" )
36
+ drive .list_items ()
37
+ except RateLimited as err :
38
+ print ("Rate limited:" , err )
Original file line number Diff line number Diff line change
1
+ from msdrive import SharePoint
2
+ from msdrive .exceptions import (
3
+ DriveException ,
4
+ InvalidAccessToken ,
5
+ ItemNotFound ,
6
+ RateLimited ,
7
+ )
8
+
9
+ # Catch generic errors
10
+ try :
11
+ drive = SharePoint ("access_token_here" )
12
+ drive .list_items ()
13
+ except DriveException as err :
14
+ print ("Something went wrong:" , err )
15
+
16
+
17
+ # Catch invalid access token
18
+ try :
19
+ drive = SharePoint ("access_token_here" )
20
+ drive .list_items ()
21
+ except InvalidAccessToken as err :
22
+ print ("Invalid access token:" , err )
23
+
24
+
25
+ # Catch item not found
26
+ try :
27
+ drive = SharePoint ("access_token_here" )
28
+ drive .list_items ()
29
+ except ItemNotFound as err :
30
+ print ("Item not found:" , err )
31
+
32
+
33
+ # Catch rate limit exceeded
34
+ try :
35
+ drive = SharePoint ("access_token_here" )
36
+ drive .list_items ()
37
+ except RateLimited as err :
38
+ print ("Rate limited:" , err )
You can’t perform that action at this time.
0 commit comments