Perform simple tasks on OneDrive through the Graph API.
Project description
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 downloading files;
- getting drive metadata including usage.
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.7 or greater.
Install and update using pip which will use the releases hosted on PyPI. Further options in the docs.
pip install graph-onedrive
Documentation
Documentation and examples are provided on GitHub: https://github.com/dariobauer/graph-onedrive/blob/main/docs/
A simple example
Run this command in the terminal after installation which will create a config file in the current folder.
$ graph-onedrive config
Save the following in a .py file in the same folder.
import os
import graph_onedrive
# Set config path
config_key = "onedrive"
config_file_name = "config.json"
current_file_path = os.path.dirname(os.path.abspath(__file__))
config_path = os.path.join(current_file_path, config_file_name)
# Create session instance
my_onedrive = graph_onedrive.create_from_config_file(config_path, config_key)
# Complete tasks using the instance. For this example we will just display the usage
my_onedrive.get_usage(verbose=True)
# Save the config to retain the refresh token.
graph_onedrive.save_to_config_file(my_onedrive, config_path, config_key)
License
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
- Documentation: https://github.com/dariobauer/graph-onedrive/blob/main/docs/
- License: https://github.com/dariobauer/graph-onedrive/blob/main/LICENSE
- Change Log: https://github.com/dariobauer/graph-onedrive/blob/main/CHANGES.md
- PyPI Releases: https://pypi.org/project/graph-onedrive
- Source Code: https://github.com/dariobauer/graph-onedrive/
- Contributing: https://github.com/dariobauer/graph-onedrive/blob/main/CONTRIBUTING.md
- Issue Tracker: https://github.com/dariobauer/graph-onedrive/issues
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file graph_onedrive-0.0.1a6.tar.gz
.
File metadata
- Download URL: graph_onedrive-0.0.1a6.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbf9e3a114ecdf61c8bdad979c918edee8c8d21143e06eafb2368739973eee9b |
|
MD5 | e9967f05cbff4c2c53b47a67cf29fa5f |
|
BLAKE2b-256 | d8cfb2085876b7568acdbd72535acbef69dd5eddaaabbbc35980536ee718f49f |
File details
Details for the file graph_onedrive-0.0.1a6-py2.py3-none-any.whl
.
File metadata
- Download URL: graph_onedrive-0.0.1a6-py2.py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6162d8fd4a6d83b4c4031c59db442e258fb1108db49eee88b423674f30f578f6 |
|
MD5 | 71a5f3e456751b4399227a089406d533 |
|
BLAKE2b-256 | 6411ef19c922b2726a3046ce2d4b45f5923d22dace7f53be97cb439219228863 |