Skip to main content

shimmers

Project description

shimmers

simple client to upload files to / from an office 365 sharepoint site using waddle to provide credential management. named after the group of hummingbirds. pax avium.

based on office365-rest-python-client

quick start

pip install shimmers

usage

uploading a file

from waddle import load_config
from shimmers import Sharepoint
from io import BytesIO
conf = load_config('path/to/conf.yml')
sharepoint = Sharepoint(conf=conf, site_name='my_site')
buff = BytesIO()
buff.write('hello, shimmers!\n'.encode('utf-8'))
sharepoint.upload(buff, 'Documents/hello_shimmers.txt')

downloading a file

from waddle import load_config
from shimmers import Sharepoint
conf = load_config('path/to/conf.yml')
sharepoint = Sharepoint(conf=conf, site_name='my_site')
buff = sharepoint.download('Documents/hello_shimmers.txt')
st = buff.getvalue().decode('utf-8')
print(st)

uploading a set of dataframes as a single excel spreadsheet

from waddle import load_config
from pandas import DataFrame
from shimmers import Sharepoint
conf = load_config('path/to/conf.yml')
sharepoint = Sharepoint(conf=conf, site_name='my_site')
df1 = DataFrame([dict(pet='sesame', type='cat'), dict(pet='peanut', type='dog')])
df2 = DataFrame([dict(pet='cody', owner='will'), dict(pet='kho', owner='boris')])
sharepoint.upload_dataframes('Documents/pets.xlsx', df1, 'names', df2, 'owners')

downloading an excel spreadsheet as a dataframe

from waddle import load_config
from pandas import DataFrame
from shimmers import Sharepoint
conf = load_config('path/to/conf.yml')
sharepoint = Sharepoint(conf=conf, site_name='my_site')
df = sharepoint.download_dataframe('Documents/pets.xlsx')
df1 = df[df.pet == 'sesame']
print(len(df1.index))


### downloading an excel spreadsheet as a dataframe, using a particular sheet

```python
from waddle import load_config
from pandas import DataFrame
from shimmers import Sharepoint
conf = load_config('path/to/conf.yml')
sharepoint = Sharepoint(conf=conf, site_name='my_site')
df = sharepoint.download_dataframe('Documents/pets.xlsx', sheet_name='nicknames')
df1 = df[df.nickname == 'meowcat']
print(len(df1.index))

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

shimmers-1.1.tar.gz (6.7 kB view hashes)

Uploaded Source

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