Metadata-Version: 2.1
Name: shimmers
Version: 1.2
Summary: shimmers
Home-page: https://bitbucket.org/dbuy/shimmers
Author: dev
Author-email: developers@directbuy.com
License: BSD
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: POSIX
Classifier: Operating System :: Unix
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Description-Content-Type: text/markdown
Requires-Dist: waddle>=1.2
Requires-Dist: office365-rest-python-client>=2.5.1
Requires-Dist: pandas
Requires-Dist: openpyxl
Requires-Dist: msal
Requires-Dist: affliction
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: coverage; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Requires-Dist: raft; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: pytest_aspec; extra == "dev"
Requires-Dist: ipython; extra == "dev"
Requires-Dist: bumpversion; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"

# shimmers

simple client to upload files to / from an office 365 sharepoint site 
using [waddle](https://pypi.org/project/waddle) to provide credential management.
named after the group of hummingbirds.  _pax avium_.

based on [office365-rest-python-client](https://github.com/vgrem/Office365-REST-Python-Client/)

## quick start

```bash
pip install shimmers
```

## usage

### uploading a file

```python
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

```python
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

```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')
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

```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')
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))
```

