Graph-OneDrive
Interact with Microsoft's OneDrive service using the Graph API.
The Graph-OneDrive package facilitates the creation of OneDrive class instances which are objects that you can use to interact with OneDrive sessions. Thus multiple OneDrives can be connected to in parallel.
Functions include:
- listing directories
- moving, copying, and renaming files and folders
- uploading and asynchronously downloading files
- getting file and drive metadata including usage
- getting links to files and creating sharing links
Azure app requirement
For the package to connect to the Graph API, you need to have an app registered in the Microsoft Azure Portal. The documentation provides basic guidance on how to register an app.
Note that some Microsoft work and school accounts will not allow apps to connect with them without admin consent.
Installation
The package currently requires Python 3.9 or greater. The last version to support Python 3.7 and 3.8 was release 0.4.0 which can still be installed.
Install and update using pip which will use the releases hosted on PyPI. Further options in the docs.
pip install -U graph-onedrive
Documentation
Documentation and examples are provided on GitHub in the docs folder.
A simple example
This is a simple example using a config file. Refer to the documentation for other instance constructors including inline options.
Run this command in the terminal after installation which will create a config file in the current working directory.
graph-onedrive --configure --authenticate -f "config.json" -k "onedrive"
Save the following in a .py file in the same folder.
from graph_onedrive import OneDriveManager
# Use a context manager to manage the session
with OneDriveManager(config_path="config.json", config_key="onedrive") as my_drive:
# Print the OneDrive usage
my_drive.get_usage(verbose=True)
# Upload a file to the root directory
new_file_id = my_drive.upload_file("my-photo.jpg", verbose=True)
License and Terms of Use
This project itself is subject to BSD 3-Clause License detailed in LICENSE.
The Graph API is provided by Microsoft Corporation and subject to their terms of use.
Links
Metadata
Release files for graph-onedrive 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| graph_onedrive-0.5.0.tar.gz | 28.2 kB | Without provenance | Details for graph_onedrive-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| graph_onedrive-0.5.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for graph_onedrive-0.5.0-py2.py3-none-any.whl |
Total release size: 54.9 kB
Release files / graph_onedrive-0.5.0.tar.gz
| Download URL | graph_onedrive-0.5.0.tar.gz |
|---|---|
| Size | 28.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dea047b38a27c84231795ac3f3cbd387685f197bf39158992450f56ed63bd1d2
|
|
BLAKE2b-256 checksum How to use checksums |
f34912c58c6b4378071c8a53e5b257088740b9465c1680bcc05d55c951e40163
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Release files / graph_onedrive-0.5.0-py2.py3-none-any.whl
| Download URL | graph_onedrive-0.5.0-py2.py3-none-any.whl |
|---|---|
| Size | 26.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
2de0223139ee44ef500e52ab4c30f68d00beb0c7d192732d7a9cddd86d12ee02
|
|
BLAKE2b-256 checksum How to use checksums |
aa56972e1a5d4d9d3b4a5ad037bb6b5493e7a96e752709c1fd4f3cdb3326ed76
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Security for graph-onedrive 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.