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 details)
File details
Details for the file shimmers-1.1.tar.gz
.
File metadata
- Download URL: shimmers-1.1.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a88399f296722a9f0ca12ab60f9a3377bf4bd5a436f08e25a1b71830300e876c |
|
MD5 | 59f3753c843a9fc1b4f7403930eaa5c7 |
|
BLAKE2b-256 | 471a661f142c8221dfd1edfa7146484bf338af75d298b88db871d00c97e9ca29 |