Service Class¶
The Yola
class is a thin wrapper over the Yola API.
-
class
yolapy.services.
Yola
(**kwargs)[source]¶ Client for Yola’s API.
yola = Yola( url='https://wl.yola.net/', auth=('username', 'password')) yola.get_user('user_id')
When appropriate, successful responses will return parsed json objects.
Failures will raise instances of demands.HTTPServiceError.
Partners¶
The following methods are mixed in to the Yola
class to provide access to the
Partner resource:
-
class
yolapy.resources.partner.
PartnerResourceMixin
[source]¶ Methods for managing Partner resources.
-
create_partner
(**attributes)[source]¶ Create a partner.
>>> partner = yola.create_partner( id='COMPANY_ID', name='Company Name', parent_partner_id='PARENT_ID', properties={'name': 'value'}) >>> partner['name'] 'Company Name'
See https://wl.qa.yola.net/partners/ for available properties.
-
get_partner
(partner_id)[source]¶ Return details for a particular partner.
>>> partner = yola.get_partner('PARTNER_ID') >>> partner['name'] 'Company Name'
-
list_partners
(**options)[source]¶ Return paginated list of partners.
>>> yola.list_partners() { 'count': 999, 'previous': None, 'next': 'https://wl.qa.yola.net/pr/partners/?page=2', 'results': [{...}, {...}, ...] }
You can pass
page_size
andpage
as keyword arguments:>>> yola.list_partners(page_size=50, page=2)
-
Users¶
The following methods are mixed in to the Yola
class to provide access to the
User resource:
-
class
yolapy.resources.user.
UserResourceMixin
[source]¶ Methods for managing User resources.
-
create_user
(**attributes)[source]¶ Create a user.
>>> user = yola.create_user( name='John', surname='Smith', email='johnsmith@example.com', partner_id='WL_PARTNER_ID', preferences={'preference_name': 'preference_value'}) >>> user['name'] 'John'
-
get_sso_create_site_url
(user_id, domain)[source]¶ Get SSO create site url for a particular user and domain.
>>> yola.get_sso_create_site_url('user_id', 'example.com')
-
get_sso_open_site_url
(user_id)[source]¶ Get SSO open site url for a particular user.
>>> yola.get_sso_open_site_url('user_id')
-
get_user
(user_id)[source]¶ Get details for a particular user.
>>> user = yola.get_user('user_id') >>> user['name'] 'John'
-
list_users
(**filters)[source]¶ Return paginated list of users.
>>> yola.list_users() { 'count': 999, 'previous': None, 'next': 'https://wl.qa.yola.net/pr/users/?page=2', 'results': [ {'name': 'John', 'surname': 'Smith', ...} ] }
If there are no users,
results
will be an empty list. No exception will be raised.You may pass pagination options and attribute filters as keyword arguments. See https://wl.qa.yola.net/users/ for available parameters.
For example:
>>> yola.list_users(page=2, page_size=50, partner_id='WL_YOLA')
-
Sites¶
The following methods are mixed in to the Yola
class to provide access to the
Site resource:
-
class
yolapy.resources.site.
SiteResourceMixin
[source]¶ Methods for managing Site resources.
-
change_site_domain
(site_id, new_domain)[source]¶ Change site’s domain.
>>> yola.change_site_domain('site_id', 'newdomain.com')
-
change_site_owner
(site_id, new_user_id)[source]¶ Change site owner.
>>> yola.change_site_owner('site_id', 'new_user_id')
-
delete_site
(site_id)[source]¶ Delete a site.
>>> yola.get_site('site_id')['deleted_at'] None >>> yola.delete_site('site_id') >>> yola.get_site('site_id')['deleted_at'] '2015-08-27T10:00:07'
-
get_site
(site_id)[source]¶ Return details for a particular site.
>>> site = yola.get_site('site_id') >>> site['name'] 'My Site'
-
list_sites
(**options)[source]¶ Return paginated list of sites.
>>> yola.list_sites() { 'count': 999, 'previous': None, 'next': 'https://wl.qa.yola.net/pr/sites/?page=2', 'results': [{...}, {...}, ...] }
You can pass
page_size
andpage
as keyword arguments:>>> yola.list_sites(page_size=50, page=2)
You can also pass filters and odering options as keyword arguments. See https://wl.qa.yola.net/sites/ for available options.
-
Subscriptions¶
The following methods are mixed in to the Yola
class to provide access to the
Subscription resource:
-
class
yolapy.resources.subscription.
SubscriptionResourceMixin
[source]¶ Methods for managing Subscription resources.
-
activate_trial_subscription
(subscription_id)[source]¶ Convert trial subscription to active.
>>> yola.activate_trial_subscription('subscription_id')
-
cancel_subscription
(subscription_id, reason)[source]¶ Cancel active subscription.
>>> yola.cancel_subscription('subscription_id', 'some reason')
-
change_subscription_type
(subscription_id, new_type)[source]¶ Change subscription type.
>>> yola.change_subscription_type('subscription_id', 'new_type')
See https://wl.qa.yola.net/subscriptions/ for available types.
-
create_subscription
(subscription_type, properties)[source]¶ Create a new subscription.
>>> properties = {...} >>> yola.create_subscription('subscription_type', properties)
See https://wl.qa.yola.net/subscriptions/ for available types and properties.
-
get_subscription
(subscription_id)[source]¶ Return details for a particular subscription.
>>> subscription = yola.get_subscription('subscription_id') >>> subscription['name'] 'My Subscription'
-
list_subscriptions
(**options)[source]¶ Return paginated list of subscriptions.
>>> yola.list_subscriptions() { 'count': 999, 'previous': None, 'next': 'https://wl.qa.yola.net/pr/subscriptions/?page=2', 'results': [{...}, {...}, ...] }
You can pass
page_size
andpage
as keyword arguments:>>> yola.list_subscriptions(page_size=50, page=2)
You can also pass filters and odering options as keyword arguments. See https://wl.qa.yola.net/subscriptions/ for available options.
-
Campaigns¶
The following methods are mixed in to the Yola
class to provide access to the
Campaign resource:
-
class
yolapy.resources.campaign.
CampaignResourceMixin
[source]¶ Methods for managing Campaign resources.
-
get_campaign
(site_id, campaign_id)[source]¶ Return details for a particular campaign.
>>> campaign = yola.get_campaign('site_id', 'campaign_id') >>> campaign['name'] 'My Campaign'
-
subscribe_to_campaign
(site_id, campaign_id)[source]¶ Subscribe to a campaign.
>>> params = {...} >>> yola.subscribe_to_campaign('site_id', 'campaign_id', params)
See https://wl.qa.yola.net/sites/SITE_ID/campaigns/ for expected params.
-