Skip to content

Commit c147a95

Browse files
committed
Rename module to adobe_umapi_client.py. Bump version to 1.0.0rc2
I also added a description of the Adobe UMAPI to the setup.py file and the README.
1 parent 36a6706 commit c147a95

File tree

9 files changed

+68
-59
lines changed

9 files changed

+68
-59
lines changed

README.md

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
1-
# adobe-umapi.py
1+
# adobe-umapi-client.py
22

3-
Python client for the Adobe User Management API, aka the
4-
[Adobe UMAPI](https://www.adobe.io/products/usermanagement/docs/gettingstarted.html)
3+
This is a Python client for the Adobe User Management API, aka the
4+
[Adobe UMAPI](https://www.adobe.io/products/usermanagement/docs/gettingstarted.html).
5+
6+
The Adobe User Management API is an Adobe-hosted network service
7+
which provides Adobe Enterprise customers the ability to manage their users. This
8+
client makes it easy to access the Adobe UMAPI from a local Python application.
9+
10+
This client is open source, maintained by Adobe, and distributed under the terms
11+
of the OSI-approved MIT license. Copyright (c) 2016 Adobe Systems Incorporated.
512

613
# Installation
714

8-
You can get this package from PyPI: `pip install adobe-umapi`.
15+
You can get this package from PyPI: `pip install adobe-umapi-client`.
916
Or you can download the posted package from GitHub and use pip
1017
to install from the download.
1118

12-
(Note: as of 13 Dec 2016, there was an issue with the PyPI posting.
13-
We are working to fix that problem.)
14-
1519
# Building
1620

1721
1. Clone this repository or download the latest stable release.
18-
2. From the command line, change to the `adobe-umapi.py` directory.
22+
2. From the command line, change to the `adobe-umapi-client.py` directory.
1923
3. To install, run the command `python setup.py install`.
2024
[**NOTE**: You may need admin/root privileges to install new packages in your environment.
2125
It is recommended that you use `virtualenv` to make a virtual python environment.
@@ -62,7 +66,7 @@ The JSON Web Token (JWT) is used to get an authorization token for using the API
6266
The `JWT` object will build the JWT for use with the `AccessRequest` object.
6367

6468
```python
65-
from adobe_umapi.auth import JWT
69+
from adobe_umapi_client.auth import JWT
6670

6771
jwt = JWT(
6872
org_id, # Organization ID
@@ -79,7 +83,7 @@ The `AccessRequest` object uses the JWT to call an IMS endpoint to obtain an acc
7983
token is then used in all later UMAPI calls to authenticate and authorize the request.
8084

8185
```python
82-
from adobe_umapi.auth import AccessRequest
86+
from adobe_umapi_client.auth import AccessRequest
8387

8488
token = AccessRequest(
8589
"https://" + ims_host + ims_endpoint_jwt, # Access Request Endpoint (IMS Host + JWT Endpoint)
@@ -103,7 +107,7 @@ Once you have an access `token`, you use it to create an Auth object. This Auth
103107
is used to build the necessary authentication headers for making an API call.
104108

105109
```python
106-
from adobe_umapi.auth import Auth
110+
from adobe_umapi_client.auth import Auth
107111

108112
auth = Auth(api_key, token())
109113
```
@@ -114,7 +118,7 @@ Once the `auth` object is built, you use it to construct a UMAPI object. This U
114118
object can then be used over and over to make your desired API calls.
115119

116120
```python
117-
from adobe_umapi import UMAPI
121+
from adobe_umapi_client import UMAPI
118122

119123
api_endpoint = 'https://usermanagement.adobe.io/v2/usermanagement'
120124
api = UMAPI(api_endpoint, auth)
@@ -124,15 +128,15 @@ api = UMAPI(api_endpoint, auth)
124128

125129
These snippets presume you have constructed a UMAPI object named `api` as detailed in the last section.
126130
The query APIs return data in paginated form, each page contaning up to 200 results.
127-
The `adobe_umapi.helper`
131+
The `adobe_umapi_client.helper`
128132
module has a `paginate` utility which can will concatenate and return the results from all pages.
129133

130134
## Get a List of Users
131135

132136
```python
133137
users = api.users(org_id, page=0) # optional arg page defaults to 0
134138

135-
from adobe_umapi.helper import paginate
139+
from adobe_umapi_client.helper import paginate
136140
all_users = paginate(api.users, org_id) # optional args for max_pages and max_records
137141
```
138142

@@ -158,7 +162,7 @@ To create the action object, we name the user we wish to operate on.
158162
(As above, `api` here in a UMAPI object.)
159163

160164
```python
161-
from adobe_umapi import Action
165+
from adobe_umapi_client import Action
162166

163167
action = Action(user="[email protected]")
164168
```
@@ -443,9 +447,9 @@ The "add" portion of the JSON looks like this:
443447
"add": {"product": ["product1"]}
444448
```
445449

446-
## adobe_umapi.auth
450+
## adobe_umapi_client.auth
447451

448-
The submodule `adobe_umapi.auth` contains the components needed to build
452+
The submodule `adobe_umapi_client.auth` contains the components needed to build
449453
the authentication headers needed for API communication.
450454

451455
### JWT
@@ -466,7 +470,7 @@ The `JWT` object is callable. Calling it returns the encoded JWT.
466470
Example:
467471

468472
```python
469-
from adobe_umapi.auth import JWT
473+
from adobe_umapi_client.auth import JWT
470474

471475
jwt = JWT(
472476
org_id, # Organization ID
@@ -495,7 +499,7 @@ Like the `JWT` object, the `AccessRequest` object is callable. Calling it retur
495499
Basic Usage Example:
496500

497501
```python
498-
from adobe_umapi.auth import AccessRequest
502+
from adobe_umapi_client.auth import AccessRequest
499503

500504
token = AccessRequest(
501505
"https://" + ims_host + ims_endpoint_jwt, # Access Request Endpoint (IMS Host + JWT Endpoint)
@@ -529,15 +533,15 @@ It is a subclass of the
529533
Example:
530534

531535
```python
532-
from adobe_umapi.auth import Auth
536+
from adobe_umapi_client.auth import Auth
533537

534538
token = AccessRequest( ... )
535539
auth = Auth(api_key, token())
536540
```
537541

538-
## adobe_umapi.error
542+
## adobe_umapi_client.error
539543

540-
The `adobe_umapi.error` submodule contains all custom Exceptions for the UMAPI library.
544+
The `adobe_umapi_client.error` submodule contains all custom Exceptions for the UMAPI library.
541545

542546
### UMAPIError
543547

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

setup.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
from setuptools import setup, find_packages
22

33

4-
setup(name='adobe-umapi',
5-
version='1.0.0rc1',
4+
setup(name='adobe-umapi-client',
5+
version='1.0.0rc2',
66
description='Adobe User Management API (UMAPI) client - see http://bit.ly/2hwkVrs',
7+
long_description=('The Adobe User Management API (aka the Adobe UMAPI) is an Adobe-hosted network service '
8+
'which provides Adobe Enterprise customers the ability to manage their users. This '
9+
'client makes it easy to access the Adobe UMAPI from a local Python application. '
10+
'This client is open source, maintained by Adobe, and distributed under the terms '
11+
'of the OSI-approved MIT license. Copyright (c) 2016 Adobe Systems Incorporated.'),
712
classifiers=[
813
'Development Status :: 5 - Production/Stable',
914
'Programming Language :: Python :: 2.7',
@@ -12,7 +17,7 @@
1217
'Intended Audience :: Developers',
1318
'Intended Audience :: System Administrators',
1419
],
15-
url='https://github.com/adobe-apiplatform/adobe-umapi.py',
20+
url='https://github.com/adobe-apiplatform/adobe-umapi-client.py',
1621
maintainer='Daniel Brotsky',
1722
maintainer_email='[email protected]',
1823
license='MIT',

tests/test_actions.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
import json
33
import pytest
44

5-
from adobe_umapi import UMAPI, Action
6-
from adobe_umapi.error import UMAPIError, UMAPIRetryError, UMAPIRequestError, ActionFormatError
7-
from adobe_umapi.auth import Auth
5+
from adobe_umapi_client import UMAPI, Action
6+
from adobe_umapi_client.error import UMAPIError, UMAPIRetryError, UMAPIRequestError, ActionFormatError
7+
from adobe_umapi_client.auth import Auth
88

99

1010
# This method will be used by the mock to replace requests.get / requests.post
@@ -27,23 +27,23 @@ def json(self):
2727
return MockResponse(404, {})
2828

2929

30-
@mock.patch('adobe_umapi.api.requests.get', side_effect=mocked_requests_call)
30+
@mock.patch('adobe_umapi_client.api.requests.get', side_effect=mocked_requests_call)
3131
def test_list_users_success(_):
3232
"""Test Users List - SUCCESS"""
3333
auth = mock.create_autospec(Auth)
3434
api = UMAPI('http://example.com/success', auth)
3535
assert api.users(None) == {"result": "success"}
3636

3737

38-
@mock.patch('adobe_umapi.api.requests.get', side_effect=mocked_requests_call)
38+
@mock.patch('adobe_umapi_client.api.requests.get', side_effect=mocked_requests_call)
3939
def test_list_users_error(_):
4040
"""Test Users List - ERROR"""
4141
auth = mock.create_autospec(Auth)
4242
api = UMAPI('http://example.com/error', auth)
4343
pytest.raises(UMAPIRequestError, api.users, None)
4444

4545

46-
@mock.patch('adobe_umapi.api.requests.get', side_effect=mocked_requests_call)
46+
@mock.patch('adobe_umapi_client.api.requests.get', side_effect=mocked_requests_call)
4747
def test_list_users_failure(_):
4848
"""Test Users List - FAILURE"""
4949
auth = mock.create_autospec(Auth)
@@ -53,15 +53,15 @@ def test_list_users_failure(_):
5353
pytest.raises(UMAPIRetryError, api.users, None)
5454

5555

56-
@mock.patch('adobe_umapi.api.requests.get', side_effect=mocked_requests_call)
56+
@mock.patch('adobe_umapi_client.api.requests.get', side_effect=mocked_requests_call)
5757
def test_list_groups_success(_):
5858
"""Test Groups List - SUCCESS"""
5959
auth = mock.create_autospec(Auth)
6060
api = UMAPI('http://example.com/success', auth)
6161
assert api.groups(None) == {"result": "success"}
6262

6363

64-
@mock.patch('adobe_umapi.api.requests.post', side_effect=mocked_requests_call)
64+
@mock.patch('adobe_umapi_client.api.requests.post', side_effect=mocked_requests_call)
6565
def test_user_create_success(_):
6666
"""Test User Creation - SUCCESS"""
6767
auth = mock.create_autospec(Auth)
@@ -74,7 +74,7 @@ def test_user_create_success(_):
7474
assert api.action(None, action) == {"result": "success"}
7575

7676

77-
@mock.patch('adobe_umapi.api.requests.post', side_effect=mocked_requests_call)
77+
@mock.patch('adobe_umapi_client.api.requests.post', side_effect=mocked_requests_call)
7878
def test_user_create_error(_):
7979
"""Test User Creation - ERROR"""
8080
auth = mock.create_autospec(Auth)
@@ -86,7 +86,7 @@ def test_user_create_error(_):
8686
pytest.raises(UMAPIRequestError, api.action, None, action)
8787

8888

89-
@mock.patch('adobe_umapi.api.requests.post', side_effect=mocked_requests_call)
89+
@mock.patch('adobe_umapi_client.api.requests.post', side_effect=mocked_requests_call)
9090
def test_user_create_failure(_):
9191
"""Test User Creation - FAILURE"""
9292
auth = mock.create_autospec(Auth)
@@ -101,7 +101,7 @@ def test_user_create_failure(_):
101101
pytest.raises(UMAPIRetryError, api.action, None, action)
102102

103103

104-
@mock.patch('adobe_umapi.api.requests.post', side_effect=mocked_requests_call)
104+
@mock.patch('adobe_umapi_client.api.requests.post', side_effect=mocked_requests_call)
105105
def test_product_add(_):
106106
"""Test Product Add - SUCCESS"""
107107
auth = mock.create_autospec(Auth)
@@ -114,7 +114,7 @@ def test_product_add(_):
114114
assert api.action(None, action) == {"result": "success"}
115115

116116

117-
@mock.patch('adobe_umapi.api.requests.post', side_effect=mocked_requests_call)
117+
@mock.patch('adobe_umapi_client.api.requests.post', side_effect=mocked_requests_call)
118118
def test_action_format_error(_):
119119
"""Test Action Format Error"""
120120
auth = mock.create_autospec(Auth)

tests/test_helper.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
import pytest
77
from six import StringIO
88

9-
import adobe_umapi.helper
10-
from adobe_umapi import UMAPI
11-
from adobe_umapi.error import UMAPIError, UMAPIRetryError
9+
import adobe_umapi_client.helper
10+
from adobe_umapi_client import UMAPI
11+
from adobe_umapi_client.error import UMAPIError, UMAPIRetryError
1212

1313

1414
# This method will be used by the mock to replace UMAPI.users
@@ -39,53 +39,53 @@ def __init__(self, status_code, headers):
3939

4040

4141
# test the pagination on success
42-
@mock.patch('adobe_umapi.UMAPI.users', side_effect=mocked_users)
42+
@mock.patch('adobe_umapi_client.UMAPI.users', side_effect=mocked_users)
4343
def test_helper_success(_):
4444
api = UMAPI('', None)
45-
assert adobe_umapi.helper.paginate(api.users, 'success') == ["user0", "user1", "user2"]
45+
assert adobe_umapi_client.helper.paginate(api.users, 'success') == ["user0", "user1", "user2"]
4646

4747

4848
@pytest.fixture
4949
def reduce_attempts():
5050
# reduce the number of retry attempts
51-
adobe_umapi.helper.retry_max_attempts = 3
51+
adobe_umapi_client.helper.retry_max_attempts = 3
5252

5353

5454
# test the retry logic with seconds in the header
55-
@mock.patch('adobe_umapi.UMAPI.users', side_effect=mocked_users)
55+
@mock.patch('adobe_umapi_client.UMAPI.users', side_effect=mocked_users)
5656
def test_helper_retry_seconds(_, reduce_attempts):
5757
api = UMAPI('', None)
58-
assert adobe_umapi.helper.paginate(api.users, 'retrySecs') == ["user1", "user2"]
58+
assert adobe_umapi_client.helper.paginate(api.users, 'retrySecs') == ["user1", "user2"]
5959

6060

6161
# test the retry logic with a time in the header
62-
@mock.patch('adobe_umapi.UMAPI.users', side_effect=mocked_users)
62+
@mock.patch('adobe_umapi_client.UMAPI.users', side_effect=mocked_users)
6363
def test_helper_fail_date(_, reduce_attempts):
6464
api = UMAPI('', None)
65-
assert adobe_umapi.helper.paginate(api.users, 'retryTime') == ["user1", "user2"]
65+
assert adobe_umapi_client.helper.paginate(api.users, 'retryTime') == ["user1", "user2"]
6666

6767

6868
# the default retry waits are really long, so don't use them while testing
6969
@pytest.fixture
7070
def reduce_delay():
7171
# reduce the wait on retry attempts
72-
adobe_umapi.helper.retry_max_attempts = 3
73-
adobe_umapi.helper.retry_exponential_backoff_factor = 1
74-
adobe_umapi.helper.retry_random_delay_max = 3
72+
adobe_umapi_client.helper.retry_max_attempts = 3
73+
adobe_umapi_client.helper.retry_exponential_backoff_factor = 1
74+
adobe_umapi_client.helper.retry_random_delay_max = 3
7575

7676

7777
# test the retry logic with a zero delay in the header
78-
@mock.patch('adobe_umapi.UMAPI.users', side_effect=mocked_users)
78+
@mock.patch('adobe_umapi_client.UMAPI.users', side_effect=mocked_users)
7979
def test_helper_retry_zero(_, reduce_delay, reduce_attempts):
8080
api = UMAPI('', None)
81-
assert adobe_umapi.helper.paginate(api.users, 'retryNone') == ["user1", "user2"]
81+
assert adobe_umapi_client.helper.paginate(api.users, 'retryNone') == ["user1", "user2"]
8282

8383

8484
# test the retry logic with no header
85-
@mock.patch('adobe_umapi.UMAPI.users', side_effect=mocked_users)
85+
@mock.patch('adobe_umapi_client.UMAPI.users', side_effect=mocked_users)
8686
def test_helper_retry_noheader(_, reduce_delay, reduce_attempts):
8787
api = UMAPI('', None)
88-
assert adobe_umapi.helper.paginate(api.users, 'retryNull') == ["user1", "user2"]
88+
assert adobe_umapi_client.helper.paginate(api.users, 'retryNull') == ["user1", "user2"]
8989

9090

9191
# py.test doesn't divert string logging, so use it
@@ -96,18 +96,18 @@ def log_stream():
9696
logger = logging.getLogger('test_logger')
9797
logger.setLevel(logging.WARNING)
9898
logger.addHandler(handler)
99-
prior_logger = adobe_umapi.helper.logger
100-
adobe_umapi.helper.logger = logger
99+
prior_logger = adobe_umapi_client.helper.logger
100+
adobe_umapi_client.helper.logger = logger
101101
yield stream
102-
adobe_umapi.helper.logger = prior_logger
102+
adobe_umapi_client.helper.logger = prior_logger
103103
handler.close()
104104

105105

106106
# test the retry logic with a custom logger
107-
@mock.patch('adobe_umapi.UMAPI.users', side_effect=mocked_users)
107+
@mock.patch('adobe_umapi_client.UMAPI.users', side_effect=mocked_users)
108108
def test_helper_retry_logging(_, log_stream, reduce_attempts):
109109
api = UMAPI('', None)
110-
assert adobe_umapi.helper.paginate(api.users, 'retrySecs') == ["user1", "user2"]
110+
assert adobe_umapi_client.helper.paginate(api.users, 'retrySecs') == ["user1", "user2"]
111111
log_stream.flush()
112112
log = log_stream.getvalue() # save as a local so can do pytest -l to see exact log
113113
assert log == '''UMAPI service temporarily unavailable (attempt 1) -- 429

0 commit comments

Comments
 (0)