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-0.10.tar.gz
(6.0 kB
view hashes)