Metadata-Version: 2.1
Name: msgraph2
Version: 0.3
Summary: A Pythonic interface to Microsoft's Graph API
Author: jhunt
License: The MIT License (MIT)
        
        Copyright (c) 2024 James Hunt
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to
        deal in the Software without restriction, including without limitation the
        rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
        sell copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in
        all copies or substantial portions of the Software..
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
        FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
        IN THE SOFTWARE.
        
Project-URL: Documentation, https://github.com/jhunt/msgraph/blob/main/README.md
Project-URL: Issues, https://github.com/jhunt/msgraph/issues
Project-URL: Source, https://github.com/jhunt/msgraph
Classifier: Programming Language :: Python :: 3.9
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests

msgraph
=======

This is a small(-ish) Python library for wrapping interactions
with Microsoft's Graph API, specifically with respect to
populating and interrogating SharePoint sites safely.

Examples
--------

```python
import msgraph

sp = msgraph.SafeSharePoint(
  host='yours.sharepoint.com',
  site='SITE-NAME',
  library='A Document Library',
  token=msgraph.file_token('path/to/token.json')
)

sp.mkdir("/Incoming/Uploaded Documents", make_parents=True)
```

Where `/path/to/token.json` looks something like this:

```json
{
  "access_token": "... your access token ..."
}
```

The `msgraph.file_token` function causes the token to be re-read
from the file every time it is needed.  Other keys in the token
JSON file will be explicitly ignored, so if you have a system of
refreshing access tokens that rewrites the on-disk file every
refresh, everything Just Works(TM).

If you are running a copy of [Oauth-Taker][1], you can point
msgraph there with the `msgraph.oauth_taker_token()` helper
instead:

[1]: https://github.com/jhunt/oauth-taker

```python
import msgraph

sp = msgraph.SafeSharePoint(
  host='yours.sharepoint.com',
  site='SITE-NAME',
  library='A Document Library',
  token=msgraph.oauth_taker_token(
    endpoint='https://ot.example.com/t/handler/t0',
    shared_key='my-sekrit-key-for-getting-tokens'
  )
)

sp.mkdir("/Incoming/Uploaded Documents", make_parents=True)
```
