A Python Wrapper for SurveyGizmo's restful API service.
Project description
# SurveyGizmo
A Python Wrapper for [SurveyGizmo](http://developer.surveygizmo.com/rest-api-documentation/)'s restful API service. Sort of - it's not really finished at the moment.
## Installation
$ pip install SurveyGizmo
## Usage
Start by instantiating the SurveyGizmo object and providing some configuration parameters. Options can also be set through the `config` property.
```python
from surveygizmo import SurveyGizmo
sg = SurveyGizmo(api_version='v3', response_type='json')
sg.config.auth_method = "user:pass"
sg.config.username = "username"
sg.config.password = "password"
```
Calls to the api are by object type then by function. For example,
```python
sg.api.survey.list()
sg.api.survey.get('39501')
sg.api.survey.copy('39501', '39501 Copy')
sg.api.surveyresponse.list('39501')
```
## Authentication
Currently, `user:pass` and `user:md5` are the only supported authentication methods. There is the `oauth_helper` module that is built on top of [rauth](https://github.com/litl/rauth), but it remains untested. You can try. *do it...*
#### user:pass
```python
sg.config.auth_method = 'user:pass'
sg.config.username = 'username'
sg.config.password = 'password'
```
#### user:md5
```python
sg.config.auth_method = 'user:md5'
sg.config.username = 'username'
sg.config.md5_hash = '5f4dcc3b5aa765d61d8327deb882cf99'
```
or you can provide a password to `config.password` and it will be automatically hashed.
#### oauth
```python
sg.config.auth_method = 'oauth'
sg.config.consumer_key = 'f5e5f0fc0300519c7gef3f4cddec396cf3d28cf192f'
sg.config.consumer_secret = 'dfa3fb80a5be5a08c5b427dbs9c4vb1ad3'
sg.config.access_token = '12345'
sg.config.access_token_secret = '54321'
```
## Config paramaters
* **api_version** - 'v3', 'head'. Defaults to 'head'
* **auth_method** - 'user:pass', 'user:md5', 'oauth'
* **username**
* **password**
* **md5_hash**
* **consumer_key**
* **consumer_secret**
* **access_token**
* **access_token_secret**
* **response_type** - None, 'json', 'pson', 'xml', 'debug'. If None, the response is returned as a python dictionary.
## Filters
Filters are currently untested.
TODO: Test filters
To filter, add filters to the query before making the api call. eg,
```python
sg.api.add_filter('datesubmitted', '<=', '2013-07-01')
sg.api.surveyresponse.list('39501')
```
By default, filters are cleared out after calls to the api. If you want to keep filters for the next call, set the `keep` parameter.
```python
sg.api.surveyresponse.list('39501', keep=True)
sg.api.surveyresponse.list('39502')
```
## API functions
Only a small subset of the API is currently implemented. This includes survey and surveyresponse objects.
TODO: Implement everything else.
## Copyright & License
Copyright © 2013 Ryan P Kilby. See LICENSE for details.
A Python Wrapper for [SurveyGizmo](http://developer.surveygizmo.com/rest-api-documentation/)'s restful API service. Sort of - it's not really finished at the moment.
## Installation
$ pip install SurveyGizmo
## Usage
Start by instantiating the SurveyGizmo object and providing some configuration parameters. Options can also be set through the `config` property.
```python
from surveygizmo import SurveyGizmo
sg = SurveyGizmo(api_version='v3', response_type='json')
sg.config.auth_method = "user:pass"
sg.config.username = "username"
sg.config.password = "password"
```
Calls to the api are by object type then by function. For example,
```python
sg.api.survey.list()
sg.api.survey.get('39501')
sg.api.survey.copy('39501', '39501 Copy')
sg.api.surveyresponse.list('39501')
```
## Authentication
Currently, `user:pass` and `user:md5` are the only supported authentication methods. There is the `oauth_helper` module that is built on top of [rauth](https://github.com/litl/rauth), but it remains untested. You can try. *do it...*
#### user:pass
```python
sg.config.auth_method = 'user:pass'
sg.config.username = 'username'
sg.config.password = 'password'
```
#### user:md5
```python
sg.config.auth_method = 'user:md5'
sg.config.username = 'username'
sg.config.md5_hash = '5f4dcc3b5aa765d61d8327deb882cf99'
```
or you can provide a password to `config.password` and it will be automatically hashed.
#### oauth
```python
sg.config.auth_method = 'oauth'
sg.config.consumer_key = 'f5e5f0fc0300519c7gef3f4cddec396cf3d28cf192f'
sg.config.consumer_secret = 'dfa3fb80a5be5a08c5b427dbs9c4vb1ad3'
sg.config.access_token = '12345'
sg.config.access_token_secret = '54321'
```
## Config paramaters
* **api_version** - 'v3', 'head'. Defaults to 'head'
* **auth_method** - 'user:pass', 'user:md5', 'oauth'
* **username**
* **password**
* **md5_hash**
* **consumer_key**
* **consumer_secret**
* **access_token**
* **access_token_secret**
* **response_type** - None, 'json', 'pson', 'xml', 'debug'. If None, the response is returned as a python dictionary.
## Filters
Filters are currently untested.
TODO: Test filters
To filter, add filters to the query before making the api call. eg,
```python
sg.api.add_filter('datesubmitted', '<=', '2013-07-01')
sg.api.surveyresponse.list('39501')
```
By default, filters are cleared out after calls to the api. If you want to keep filters for the next call, set the `keep` parameter.
```python
sg.api.surveyresponse.list('39501', keep=True)
sg.api.surveyresponse.list('39502')
```
## API functions
Only a small subset of the API is currently implemented. This includes survey and surveyresponse objects.
TODO: Implement everything else.
## Copyright & License
Copyright © 2013 Ryan P Kilby. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
SurveyGizmo-0.0.5.tar.gz
(11.5 kB
view details)
Built Distribution
SurveyGizmo-0.0.5.linux-i686.exe
(79.4 kB
view details)
File details
Details for the file SurveyGizmo-0.0.5.tar.gz
.
File metadata
- Download URL: SurveyGizmo-0.0.5.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | beb9c36feee923eaee47bceadb8005a0599ae0f1960d801dc1b2f6a3923bd0b8 |
|
MD5 | 3c88044bfe8d517f956d7ab61ecba61a |
|
BLAKE2b-256 | 2d4a0d85a5451acbb42776e4c374bfc1b1fea536e6fe7c61c5ec420bd8c3e27c |
File details
Details for the file SurveyGizmo-0.0.5.linux-i686.exe
.
File metadata
- Download URL: SurveyGizmo-0.0.5.linux-i686.exe
- Upload date:
- Size: 79.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35377f19fb990669f13df9effa00379e9ac685976442294bc20ed8c424f7edad |
|
MD5 | a2397841785c9a7f21cb1f76c241239b |
|
BLAKE2b-256 | e77b77650846d0204446b77273820ac99d5721bf3a379e5034281c61b7e1c2c7 |