Skip to main content

Installation

Use pip:

pip install sp_storage

or

pip install git+https://github.com/shineum/sp_storage.git

Getting Started

Set the following in your settings.py:

SHAREPOINT_TENANT = '<tenant name>'
SHAREPOINT_TENANT_ID = '<tenant id - uuid format>'
SHAREPOINT_CLIENT_ID = '<client id - uuid format>'
SHAREPOINT_CLIENT_SECRET = '<client secret>'
SHAREPOINT_USERNAME = '<username>'
SHAREPOINT_PASSWORD = '<password>'
SHAREPOINT_SITE_NAME = '<site name>'
SHAREPOINT_ROOT_DIR = '<root dir>'
SHAREPOINT_BLOB_MAX_MEMORY_SIZE = '<blob file size - defulat 16M>'

note: If 'SHAREPOINT_CLIENT_ID' and 'SHAREPOINT_CLIENT_SECRET' are provided 'SHAREPOINT_USERNAME' and 'SHAREPOINT_PASSWORD' will be ignored.

Usage

Fields

Set the default storage as 'sp_storage.sharepoint.SharepointStorage' or import SharepointStorage and set storage for each models.

DEFAULT_FILE_STORAGE = 'sp_storage.sharepoint.SharepointStorage'

# model
from django.db import models

class Sample(models.Model):
    pdf = models.FileField(upload_to='pdfs')

or

# model
from sp_storage.sharepoint import SharepointStorage
from django.db import models

class Sample(models.Model):
    pdf = models.FileField(upload_to='pdfs', storage=SharepointStorage)

Storage

>>> from sp_storage.sharepoint import SharepointStorage
>>> storage = SharepointStorage()

>>> storage.exists('storage_test')
False

>>> file = storage.open('storage_test', 'w')
>>> file.write('storage test')
>>> file.close()

>>> storage.exists('storage_test')
True

>>> file = storage.open('storage_test', 'r')
>>> file.read()
b'storage test'
>>> file.close()

>>> storage.delete('storage_test')
>>> storage.exists('storage_test')
False

Metadata

Release files for sp-storage 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sp-storage 0.0.1
File Size Uploaded Provenance Actions
sp_storage-0.0.1.tar.gz 4.8 kB Without provenance Details for sp_storage-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sp-storage 0.0.1
File Interpreter ABI Platform Actions
sp_storage-0.0.1-py3-none-any.whl Python 3 none any Details for sp_storage-0.0.1-py3-none-any.whl

Total release size: 10.3 kB

Release files / sp_storage-0.0.1.tar.gz

Download URL sp_storage-0.0.1.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f822cde7e3371cc182d39f627c2085092cc819f7d855aa8e7bae69b507685772
BLAKE2b-256 checksum
How to use checksums
a446ea965a99fe63f773c52c510f6d2ff4d20d50a7fbf4d05a7223afbc50b18a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.5

Release files / sp_storage-0.0.1-py3-none-any.whl

Download URL sp_storage-0.0.1-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
11061f192102c146fcd3b25e062674c26e82cadae1ec7e47b7ec0a5422148ea5
BLAKE2b-256 checksum
How to use checksums
fe2a6e678c552ed3dc661d9d699b0ce735d404129b1f23462566bc35e59051f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.5

Security for sp-storage 0.0.1

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.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page