Skip to main content

sellsy_api is a tiny client for Sellsy API

Project description


# sellsy-api
> A tiny client to manage your Sellsy plateform using Python

sellsy-api is a client for the official [Sellsy API](https://api.sellsy.com) in order to allow you to get and manipulate data from [Sellsy plateform](https://welcome.sellsy.com/). The official client was written in PHP, here is a client written in pure python.

### Features
- Allows you to connect with your Oauth private API keys
- Access to all methods listed [here](https://api.sellsy.com/documentation/methods) with only a single function
- Error handler

### Requirements
* [Python 2/3](https://www.python.org/),
* A Python Package Manager ([pip](https://pip.pypa.io/en/stable/installing/), [pipenv](http://pipenv.readthedocs.io/en/latest/), [conda](https://conda.io/docs/), ..)


## Installing

If you are using pip as PM:

```shell
# Connect to your virtualenv
$ workon projectenv

# Use pip to install the package
$ pip install sellsy_api
```

Or if you are using pipenv (pip needs to be installed too):
```shell

$ cd /path/to/my/project
$ pipenv install sellsy_api
```

Verify now if the package as been successfully installed
```shell
$ python
>> import sellsy_api # Should not raise exception
```

## Quick Start

```python
import os
import sellsy_api

client = sellsy_api.Client(
'my_consumer_token',
'my_consumer_secret',
'my_user_token',
'my_user_secret')

try:
infos = client.api(method='Infos.getInfos')
prospect = client.api(method='Prospects.getOne', params={ 'id': 55 })
except sellsy_api.SellsyAuthenticateError as e: # raised if credential keys are not valid
print('Authentication failed ! Details : {}'.format(e))
except sellsy_api.SellsyError as e: # raised if an error is returned by Sellsy API (
print(e)

prospect_name = prospect['corporation']['name']

```

You can access the full Sellsy API [methods](https://api.sellsy.com/documentation/methods) using `client.api(method='', params={})`.

The function returns a dictionary containing the response:
```json
{
"corporation":{
"id":"55",
"corpid":"644",
"name":"New Prospect",
"...":"...",
"created":"2013-01-31 14:49:35",
"updated":"2013-01-31 16:41:38"
},
"contacts":[
{
"id":"44",
"prospectid":"55",
"...":"...",
"sign":"",
"birthdate":"0000-00-00"
}
]
}
```

For now, two exceptions could be raised by calling the function:
- `SellsyAuthenticateError` : if one of `consumer_key`, `consumer_secret`, `user_token` or `user_secret` is invalid or if authentication failed
- `SellsyError`: Sellsy API could return error depends on unexcistant ressource or method not valid for example. So this exception is raised and you can access the exception infos to have more details or error : `{code} - {detail}` where `code` if one of code error described [here](https://api.sellsy.com/documentation/errors) (in Error Process tab).
- _COMING SOON_: more exceptions to catch precise errors through distinct exceptions (example: SellsyRessourceNotFound if the ressource you asked for does not exists) and not only through a unique `SellsyError` with different messages...


## Links

- [Sellsy plateform](https://welcome.sellsy.com/)
- [Sellsy API](https://api.sellsy.com)
- [sellsy-api issue tracker](https://github.com/Annouar/sellsy-client/issues)


## License

- **MIT** : http://opensource.org/licenses/MIT

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

sellsy_api-0.0.2.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sellsy_api-0.0.2-py2.py3-none-any.whl (5.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file sellsy_api-0.0.2.tar.gz.

File metadata

  • Download URL: sellsy_api-0.0.2.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for sellsy_api-0.0.2.tar.gz
Algorithm Hash digest
SHA256 ed60f7d4c8a1d2697498f7058c042f9ae60c57802601ff9e7e854a398b0eb21b
MD5 5286a2041dbc4d59d91e2c53e9ec2d48
BLAKE2b-256 4e3bd65f3c0dfa13a669e497dd90aa96bcf83fa10a5c6dc445ae387488c15e75

See more details on using hashes here.

File details

Details for the file sellsy_api-0.0.2-py2.py3-none-any.whl.

File metadata

  • Download URL: sellsy_api-0.0.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for sellsy_api-0.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 fdb83be50258dfabaab96f87ef3b9094f76de2ebba38980fb722412c27f89460
MD5 3a29c61ef40d637b2cbb1981931fef36
BLAKE2b-256 16ad9bb7b00bf00c0e055f07858924e550caf8294c3258aa9c09588706810015

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page