Skip to main content

SharePoint Too

Coverage

Overview

This module will handle authentication for your SharePoint Online/O365 site, allowing you to make straightforward HTTP requests from Python. It extends the commonly used Requests module, meaning that returned objects are familliar, easy to work with and well documented. Leverages requests_ntlm for authentication.

Inspired by Sharepy which seems to no longer be maintained.

NOTE: Currently handles dealing with SharePoint Lists via handy shortcut methods, but you can currently also call sp.get(url, *args, **kwargs) and sp.post(url, *args, **kwargs) with manually assembled SharePoint REST URLs and it will work.

Installation

python3 -m pip install sharepoint-too

Usage

Initiate a SharePoint session

from sharepoint_too import SharePointSession
sp = SharePointSession("example.sharepoint.com")

Make an API call

r = sp.get_lists()

This will return a Requests response object. See the requests documentation for details. By default, the headers accept: application/json;odata=verbose and content-type: application/json;odata=verbose are sent with all requests, so API responses will be formatted as JSON where available.

Headers can be added or overridden by supplying a dictionary to the relevant method:

r = sp.get_lists(headers={"Accept": "application/atom+xml"})

Currently the post() method will send a x-requestdigest header, allowing modifications to be made to SharePoint objects.

Other available methods

sp.get_list_metadata(weblist_url, list_guid=None, list_title=None)
sp.get_list_entity_type(weblist_url, list_guid=None, list_title=None)
sp.get_list_items(weblist_url, list_guid=None, list_title=None)
sp.get_list_item(weblist_url, item_id, list_guid=None, list_title=None)
sp.add_list_item(weblist_url, payload, list_guid=None, list_title=None)
sp.update_list_item(weblist_url, item_id, data, list_guid=None, list_title=None)
sp.upload(weblist_url, item_id, filename, list_guid=None, list_title=None)
sp.delete_list_item(weblist_url, item_id, list_guid=None, list_title=None)

NOTE: Only list_guid or list_title need to be supplied, not both.

Development

To get a list of all commands with descriptions simply run make.

make env
make pip_install
make pip_install_editable

Testing

make pytest
make coverage
make open_coverage

Issues

If you experience any issues, please create an issue on GitHub.

History

All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

0.3.0 (2024-05-10)

  • Changed: Use modern Python tooling. Update to work with Python 3.9.x.

0.2.0 (2021-09-23)

  • Changed: Now you must pass on open file as content along with desired filename. We can't assume the file is local, it may be local or in the cloud. Such as with Django storages.

0.1.2 (2020-06-08)

  • When uploading a file to SharePoint we use just the filename and not the full file path.

0.1.1 (2020-04-27)

  • Updated license and installaton instructions due to typo.

0.1.0 (2020-04-27)

  • First release on PyPI.

Metadata

Release files for sharepoint-too 0.3.0

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

Source distribution (sdist)

Source distribution for sharepoint-too 0.3.0
File Size Uploaded
sharepoint_too-0.3.0.tar.gz 10.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sharepoint-too 0.3.0
File Interpreter ABI Platform
sharepoint_too-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.5 kB

Release files / sharepoint_too-0.3.0.tar.gz

Download URL sharepoint_too-0.3.0.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cf749a2851cce01aa86a0f6768fdfdd0fd54e73383f85339669ef8636a5a062f
BLAKE2b-256 checksum
How to use checksums
ae0d6a062fbaa3c14608fb94e4fe34d6a37f6a2042820099307d9121fcbc9c5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.11

Release files / sharepoint_too-0.3.0-py3-none-any.whl

Download URL sharepoint_too-0.3.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f9dbef5b2fee7a41bf938cf550ee2b7167fd86f8860664a9582106547b91e53
BLAKE2b-256 checksum
How to use checksums
5096ea921ee28130fbc0f973032cee4bada89a18833b6fd000aa9248cb8ae1d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.11

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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