from requests_oauthlib import OAuth1
from connect_ext_ppr.client import CBCClient
# CBC Endpoint
endpoint = '******'
# CBC OAuth Key
client_id = '*****'
# CBC OAuth Key
client_secret = '*****'
# CBC Extension App ID
app_id = '*****'
client = CBCClient(
endpoint=endpoint,
auth=OAuth1(client_id, client_secret),
app_id=app_id,
)
Syntax:
client['resource-identifier'].get()
Example - getting account with resource id 'afe386ae-1506-49b1-8c5d-b583b2eb6456':
account = client['afe386ae-1506-49b1-8c5d-b583b2eb6456'].get()
Syntax:
client('aps-type')
Example of account service identification:
client('http://aps-standard.org/types/core/account')
Example of getting details of an account with id '1000017':
accounts = client('http://aps-standard.org/types/core/account').get(id=1000017)
Example of listing all accounts:
accounts = client('http://aps-standard.org/types/core/account').get()
Examples:
client('aps-type').collection.subs_collection.get()
client('aps-type').collection.subs_collection.action(
name='action-name',
payload=payload,
)
Examples:
client('aps-type').collection.subs_collection['identifier'].get()
client('aps-type').collection.subs_collection['identifier'].action(
name='action-name',
payload=payload,
)