Skip to content

Commit cf88c7a

Browse files
authored
Merge pull request #4 from tzengerink/feature/add-to-pypi
Allow adding to PyPI
2 parents 4d27ec3 + 3eac9cf commit cf88c7a

7 files changed

Lines changed: 45 additions & 73 deletions

File tree

CHANGES.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Changelog
2+
=========
3+
4+
Here you find a full list of changes.
5+
6+
Version 1.2.1
7+
-------------
8+
9+
- Add usabilla to PyPi
10+
11+
Version 1.2.0
12+
-------------
13+
14+
- Added In-Page resource
15+
16+
Version 1.1.0
17+
-------------
18+
19+
- Resources are now retrieved by providing the following:
20+
- A scope
21+
- A product name
22+
- A resource type

README.MD

Lines changed: 9 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -20,98 +20,42 @@ It makes use of the API to request the following products and resources:
2020

2121
###Usabilla for Apps
2222
- Apps
23-
- Feedback items
23+
- Feedback items
2424

2525
For more information on resources, authorization and available API calls, please visit out [documentation](https://usabilla.com/api).
2626

27-
Changes in version 1.2
28-
- Added In-Page resource
29-
30-
Changes in version 1.1
31-
Resources are now retrieved by providing the following:
32-
- A scope
33-
- A product name
34-
- A resource type
35-
3627
# Installation:
37-
Requires Python 2.7. (Need Collections.OrderedDict)
28+
29+
Requires Python 2.7
3830

3931
```bash
40-
python setup.py install
32+
pip install usabilla-api
4133
```
4234

43-
# Usage:
44-
## sample command:
35+
# Buttons example:
4536
```python
4637
>>> import usabilla as ub
47-
>>> api = ub.APIClient('CLIENT-API-KEY', 'CLIENT-SECRET-KEY')
38+
>>> api = ub.APIClient('YOUR-ACCESS-KEY', 'YOUR-SECRET-KEY')
4839
>>> api.set_query_parameters({'limit' : 1})
4940
>>> buttons = api.get_resource(api.SCOPE_LIVE, api.PRODUCT_WEBSITES,api.RESOURCE_BUTTON)
5041
>>> print buttons
5142
```
5243

53-
## output
54-
```json
55-
{
56-
"count": 1,
57-
"items": [
58-
{
59-
"_id" : "8d73568ac2be",
60-
"name" : "My button",
61-
}
62-
],
63-
"hasMore": true,
64-
"lastTimestamp": 1421232571909752
65-
}
66-
```
67-
68-
###Iterators:
44+
### Iterators
6945

7046
When working with the <code>limit</code> parameters (default value is **100**) you can request resources using the <code>item_iterator()</code> function.
7147
The API returns data in pages. This function returns a [Generator](https://wiki.python.org/moin/Generators) which
7248
traverses these pages for you and yields each result in the current page before retrieving the next page.
7349

74-
##Example usage:
50+
## Feedback example
7551

7652
```python
7753
>>> import usabilla as ub
7854
>>> import json
79-
>>> api = ub.APIClient('CLIENT-API-KEY', 'CLIENT-SECRET-KEY')
55+
>>> api = ub.APIClient('YOUR-ACCESS-KEY', 'YOUR-SECRET-KEY')
8056
>>> api.set_query_parameters({'limit' : 1})
8157
>>> feedbackItems = api.get_resource(api.SCOPE_LIVE, api.PRODUCT_WEBSITES,api.RESOURCE_FEEDBACK,'*',iterate=True)
8258
>>> print json.dumps([item for item in feedbackItems], indent=4)
8359
```
8460

8561
Where <code>id</code> is the button id from which the feedback originates.
86-
87-
## output
88-
```json
89-
{
90-
"id" : "5499612ec4698839368b4573",
91-
"userAgent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36",
92-
"comment" : "A random comment.",
93-
"location" : "Amsterdam, Netherlands",
94-
"date" : "2014-01-15T19:48:06.003Z",
95-
"custom" : {
96-
"form_name" : "form1"
97-
},
98-
"email" : "dev@usabilla",
99-
"htmlSnippet" : "<a href=\"#\">An anchor element</a>",
100-
"image" : "http://usabilla-feedback-dev.s3.amazonaws.com/5499612ec4698839368b4573/detail",
101-
"labels" : [
102-
"label 1",
103-
"label 2"
104-
],
105-
"nps" : 10,
106-
"publicUrl" : "http://usabilla.dev/feedback/item/a5cadaf3febf44393401a4be3ebbbf155d9f8d2c",
107-
"rating" : 5,
108-
"buttonId" : "8d73568ac2be",
109-
"tags" : [
110-
"interesting",
111-
"unattractive"
112-
],
113-
"url" : "http://usabilla.com/member/live/site/8d73568ac2be"
114-
}
115-
```
116-
117-
**Note:** Every response is in json format.

examples/buttons_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
if __name__ == '__main__':
77
# Create an API client with client and secret keys
8-
api = ub.APIClient('CLIENT-API-KEY', 'CLIENT-SECRET-KEY')
8+
api = ub.APIClient('YOUR-ACCESS-KEY', 'YOUR-SECRET-KEY')
99

1010
# Set the limit of buttons to retrieve to 1
1111
api.set_query_parameters({'limit': 1})

examples/feedback_iterator_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
if __name__ == '__main__':
77
# Create an API client with client and secret keys
8-
api = ub.APIClient('CLIENT-API-KEY', 'CLIENT-SECRET-KEY')
8+
api = ub.APIClient('YOUR-ACCESS-KEY', 'YOUR-SECRET-KEY')
99

1010
# Set the limit of feedback items to retrieve to 1
1111
api.set_query_parameters({'limit': 1})

setup.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@
33
# 3. If at all possible, it is good practice to do this. If you cannot, you
44
# will need to generate wheels for each Python version that you support.
55
universal=1
6+
7+
[metadata]
8+
description-file = README.MD

setup.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@
33
except ImportError:
44
from distutils.core import setup
55

6+
VERSION = '1.2.1'
7+
68
setup(
7-
name='usabilla',
8-
version='1.1',
9+
name='usabilla-api',
10+
version=VERSION,
911
description="Python client for Usabilla API",
1012
license='MIT',
1113
install_requires=['urllib3', 'requests'],
1214
packages=find_packages(),
1315
py_modules=['usabilla'],
14-
author='George V.',
15-
author_email='george@usabilla.com',
16-
url='http://usabilla.com/api',
16+
author='Usabilla',
17+
author_email='development@usabilla.com',
18+
url='https://github.com/usabilla/api-python',
19+
download_url='https://github.com/usabilla/api-python/tarball/%s' % VERSION,
1720
test_suite='tests'
1821
)

tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
import logging
11-
11+
1212
logging.basicConfig(level=logging.DEBUG)
1313

1414
class TestCredentials(TestCase):

0 commit comments

Comments
 (0)