Skip to main content

Package for OneDrive File Management

Project description

OneDrive Integration Package


onedriveintegrate is a Python package for OneDrive functionality, featuring methods for OneDrive file management and interacting Microsoft OneDrive API.

List of relevant operations:

  • Authenticate users using Microsoft Graph API
  • Write files to a folder
  • Read files from the drive
  • List contents of a folder
  • Search for files based on text/id

Installation


Use a simple pip command to install onedriveintegrate:

pip install onedriveintegrate

Usage / Getting started

from onedriveintegrate.onedrive_api import OneDriveAPI
from onedriveintegrate.ms_graph import generate_access_token, GRAPH_API_ENDPOINT

# User's Client ID
client_ID = 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'

# Setup 
onedrive_query = OneDriveAPI(client_ID)
folder_id = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
file_path = 'root/base/relative/file'
file_id = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
output_file = 'XXXXX.json'
search_txt = 'XXXXX'

# 1) Upload file to specified folder
onedrive_query.write_file(folder_id, file_path)

# 2) Download file from specified id
onedrive_query.read_file(file_id)

# 3) List contents of folder, results stored in output_file
onedrive_query.list_folder(folder_id, output_file)

# 4) Search item based on search text/id, results storted in output_file
onedrive_query.search_text(search_txt, output_file)
onedrive_query.search_id(file_id OR folder_id, output_file)

Helpful Resources

Sources from Jie Jenn:

Microsoft Graph API:

PyPi:

Markdown:

Acknowledgements

This package makes use of Jie Jenn's ms_graph.py for the user authentication process.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

onedriveintegrate-1.2.tar.gz (4.0 kB view details)

Uploaded Source

File details

Details for the file onedriveintegrate-1.2.tar.gz.

File metadata

  • Download URL: onedriveintegrate-1.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for onedriveintegrate-1.2.tar.gz
Algorithm Hash digest
SHA256 60aee41dbbf704ffd05abec949401abe916cc9b7404b0bfcb0beb5d0671babf9
MD5 583b6346f6a824aafec5e29bef59245b
BLAKE2b-256 520a1708ced9f049be6fd9cd679e5bcc28752c3b606beedfb7dafd1e9d0734f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page