Metadata-Version: 2.1
Name: onedrive-sharepoint-python-sdk
Version: 0.0.1
Summary: A Python SDK for accessing files in OneDrive & SharePoint using the Microsoft Graph API
Author-email: fire015 <emailfire@gmail.com>
License: MIT License
        
        Copyright (c) 2022 Jason M
        
        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: Homepage, https://github.com/fire015/onedrive-sharepoint-python-sdk
Project-URL: Bug Tracker, https://github.com/fire015/onedrive-sharepoint-python-sdk/issues
Keywords: onedrive,sharepoint,microsoft
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Provides-Extra: tests
License-File: LICENSE.txt

# OneDrive and SharePoint Python SDK
A Python SDK for accessing files in OneDrive & SharePoint using the [Microsoft Graph API](https://docs.microsoft.com/en-us/onedrive/developer/rest-api/?view=odsp-graph-online).

Functionality includes:
* Upload and download files
* List files and folders in directories
* List the SharePoint sites that you follow
* Search for a SharePoint site and it's drives

## Installation
Requires Python 3.7+

```
pip install onedrive-sharepoint-python-sdk
```

## Examples
See the [examples](https://github.com/fire015/onedrive-sharepoint-python-sdk/tree/master/examples) folder for more.

### OneDrive
```python
from msdrive import OneDrive

drive = OneDrive("access_token_here")

drive.download_item(item_path="/Documents/my-data.csv", file_path="my-data.csv")
drive.upload_item(item_path="/Documents/new-or-existing-file.csv", file_path="new-or-existing-file.csv")
```

### SharePoint
```python
from msdrive import SharePoint

drive = SharePoint("access_token_here")

drive.download_item(drive_id="b!...", item_path="/General/shared-data.csv", file_path="shared-data.csv")
drive.upload_item(drive_id="b!...", item_path="/General/new-or-existing-file.csv", file_path="new-or-existing-file.csv")
```

## Authentication
The SDK does not handle authentication, it presumes you already have a Microsoft access token which you pass into the constructor (see [auth example](https://github.com/fire015/onedrive-sharepoint-python-sdk/blob/master/examples/auth.py)).

Use a library like [MSAL](https://pypi.org/project/msal/) or [Azure Identity](https://pypi.org/project/azure-identity/) to handle this.

## Local Development
```
pip install -e .[tests]
pytest # run unit tests
```
