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.3.tar.gz (4.0 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: onedriveintegrate-1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 e16587cb1504c99e717621b54634325ccf230ce37dec4424f5141aa11a334473
MD5 4be03ceac846cc8d52c05aaaa8650748
BLAKE2b-256 1a3023cde13f2dcf6a9ef8cb35347e844ddaac43772a64140daa9a0026bb7908

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