Skip to main content

A basic sharepoint wrapper to be used with app-only credentials

Project description

Sharepoint Wrapper

Create Cofiguration

from sharepoint_wrapper import SharePointConfig

config = SharePointConfig(
    tenant="<tenant>",
    tenant_domain="<tenant_domain>",
    client_id="<client_id>",
    client_secret="<client_secret>",
    site="<site_name>",
)

Get Folders

from sharepoint_wrapper import get_folders

folders_at_root = get_folders(config)
# or 
# ensure your path starts with a slash "/"
folders_at_path = get_folders(config, "/my/path") 

Get Files

from sharepoint_wrapper import get_files

files_at_root = get_files(config)
# or 
# ensure your path starts with a slash "/"
files_at_path = get_files(config, "/my/path") 

Get File Content

from sharepoint_wrapper import get_file_content
from io import BytesIO

file_name = "my_file.pdf"

# returns a BytesIO file

file_at_root: BytesIO = get_file_content(config, file_name)
# or 
# ensure your path starts with a slash "/"
file_at_path: BytesIO = get_file_content(config, file_name, "/my/path") 

Upload a file

:warning: Note: Upload response will only be returned in case of success if upload fails, an exception will be raised

from sharepoint_wrapper import upload_file
from io import BytesIO

with open('path/to/your/file', 'rb') as file:
    file_content = file.read()

# Note: Upload response will only be returned in case of success
# if upload fails, an exception will be raised

upload_response: dict = upload_file(config, file_content, "file_name.txt")
# or 
# ensure your path starts with a slash "/"
upload_response: dict = upload_file(config, file_content, "file_name.txt", "/my/path") 

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

sharepoint_wrapper-0.0.2.20241108.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file sharepoint_wrapper-0.0.2.20241108.1.tar.gz.

File metadata

File hashes

Hashes for sharepoint_wrapper-0.0.2.20241108.1.tar.gz
Algorithm Hash digest
SHA256 020bf170c81fd1ab89ece71b9963bb2a3cc9d550d93dda2db739196b10a633bd
MD5 eaaa931071a45fd8e9bfabacbd7d3702
BLAKE2b-256 a2d236ca056db1ab22e801a45f6ae178f1c69939a28102a3d2472d3eca6d99c4

See more details on using hashes here.

File details

Details for the file sharepoint_wrapper-0.0.2.20241108.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sharepoint_wrapper-0.0.2.20241108.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8994175c33aa36bd833d8c7fbfba94b2206c313f9907c7ef7c5dc5e0b9b1d764
MD5 bd8bc09cb593a6227a04d233f8d2e0c1
BLAKE2b-256 e690963eb12d21e68ed6af12107a2fbdd0fdad67eb84f425a22aefd63078e4b8

See more details on using hashes here.

Supported by

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