Search is not available for this dataset
text stringlengths 75 104k |
|---|
def _check_audience(payload_dict, audience):
"""Checks audience field from a JWT payload.
Does nothing if the passed in ``audience`` is null.
Args:
payload_dict: dict, A dictionary containing a JWT payload.
audience: string or NoneType, an audience to check for in
the JWT... |
def _verify_time_range(payload_dict):
"""Verifies the issued at and expiration from a JWT payload.
Makes sure the current time (in UTC) falls between the issued at and
expiration for the JWT (with some skew allowed for via
``CLOCK_SKEW_SECS``).
Args:
payload_dict: dict, A dictionary contai... |
def verify_signed_jwt_with_certs(jwt, certs, audience=None):
"""Verify a JWT against public certs.
See http://self-issued.info/docs/draft-jones-json-web-token.html.
Args:
jwt: string, A JWT.
certs: dict, Dictionary where values of public keys in PEM format.
audience: string, The au... |
def get(self, template_id, **queryparams):
"""
Get information about a specific template.
:param template_id: The unique id for the template.
:type template_id: :py:class:`str`
:param queryparams: The query string parameters
queryparams['fields'] = []
queryparams... |
def update(self, template_id, data):
"""
Update the name, HTML, or folder_id of an existing template.
:param template_id: The unique id for the template.
:type template_id: :py:class:`str`
:param data: The request body parameters
:type data: :py:class:`dict`
data... |
def delete(self, template_id):
"""
Delete a specific template.
:param template_id: The unique id for the template.
:type template_id: :py:class:`str`
"""
self.template_id = template_id
return self._mc_client._delete(url=self._build_path(template_id)) |
def get_subscriber_hash(member_email):
"""
The MD5 hash of the lowercase version of the list member's email.
Used as subscriber_hash
:param member_email: The member's email address
:type member_email: :py:class:`str`
:returns: The MD5 hash in hex
:rtype: :py:class:`str`
"""
check_em... |
def check_url(url):
"""
Function that verifies that the string passed is a valid url.
Original regex author Diego Perini (http://www.iport.it)
regex ported to Python by adamrofer (https://github.com/adamrofer)
Used under MIT license.
:param url:
:return: Nothing
"""
URL_REGEX = re.... |
def merge_results(x, y):
"""
Given two dicts, x and y, merge them into a new dict as a shallow copy.
The result only differs from `x.update(y)` in the way that it handles list
values when both x and y have list values for the same key. In which case
the returned dictionary, z, has a value according... |
def create(self, data):
"""
Create a new list in your MailChimp account.
:param data: The request body parameters
:type data: :py:class:`dict`
data = {
"name": string*,
"contact": object*
{
"company": string*,
"... |
def update_members(self, list_id, data):
"""
Batch subscribe or unsubscribe list members.
Only the members array is required in the request body parameters.
Within the members array, each member requires an email_address
and either a status or status_if_new. The update_existing ... |
def update(self, list_id, data):
"""
Update the settings for a specific list.
:param list_id: The unique id for the list.
:type list_id: :py:class:`str`
:param data: The request body parameters
:type data: :py:class:`dict`
data = {
"name": string*,
... |
def create(self, store_id, order_id, data):
"""
Add a new line item to an existing order.
:param store_id: The store id.
:type store_id: :py:class:`str`
:param order_id: The id for the order in a store.
:type order_id: :py:class:`str`
:param data: The request bod... |
def get(self, **queryparams):
"""
Get links to all other resources available in the API.
:param queryparams: The query string parameters
queryparams['fields'] = []
queryparams['exclude_fields'] = []
"""
return self._mc_client._get(url=self._build_path(), **queryp... |
def create(self, data):
"""
Retrieve OAuth2-based credentials to associate API calls with your
application.
:param data: The request body parameters
:type data: :py:class:`dict`
data = {
"client_id": string*,
"client_secret": string*
}
... |
def get(self, app_id, **queryparams):
"""
Get information about a specific authorized application
:param app_id: The unique id for the connected authorized application
:type app_id: :py:class:`str`
:param queryparams: The query string parameters
queryparams['fields'] = [... |
def create(self, store_id, data):
"""
Add new promo rule to a store
:param store_id: The store id
:type store_id: :py:class:`str`
:param data: The request body parameters
:type data: :py:class:`dict'
data = {
"id": string*,
"title": string... |
def get(self, folder_id, **queryparams):
"""
Get information about a specific folder used to organize campaigns.
:param folder_id: The unique id for the campaign folder.
:type folder_id: :py:class:`str`
:param queryparams: The query string parameters
queryparams['fields'... |
def delete(self, folder_id):
"""
Delete a specific campaign folder, and mark all the campaigns in the
folder as ‘unfiled’.
:param folder_id: The unique id for the campaign folder.
:type folder_id: :py:class:`str`
"""
self.folder_id = folder_id
return self... |
def get(self, workflow_id, email_id):
"""
Get information about an individual Automation workflow email.
:param workflow_id: The unique id for the Automation workflow.
:type workflow_id: :py:class:`str`
:param email_id: The unique id for the Automation workflow email.
:t... |
def create(self, data):
"""
Upload a new image or file to the File Manager.
:param data: The request body parameters
:type data: :py:class:`dict`
data = {
"name": string*,
"file_data": string*
}
"""
if 'name' not in data:
... |
def get(self, file_id, **queryparams):
"""
Get information about a specific file in the File Manager.
:param file_id: The unique id for the File Manager file.
:type file_id: :py:class:`str`
:param queryparams: The query string parameters
queryparams['fields'] = []
... |
def update(self, file_id, data):
"""
Update a file in the File Manager.
:param file_id: The unique id for the File Manager file.
:type file_id: :py:class:`str`
:param data: The request body parameters
:type data: :py:class:`dict`
data = {
"name": stri... |
def delete(self, file_id):
"""
Remove a specific file from the File Manager.
:param file_id: The unique id for the File Manager file.
:type file_id: :py:class:`str`
"""
self.file_id = file_id
return self._mc_client._delete(url=self._build_path(file_id)) |
def _build_path(self, *args):
"""
Build path with endpoint and args
:param args: Tokens in the endpoint URL
:type args: :py:class:`unicode`
"""
return '/'.join(chain((self.endpoint,), map(str, args))) |
def _iterate(self, url, **queryparams):
"""
Iterate over all pages for the given url. Feed in the result of self._build_path as the url.
:param url: The url of the endpoint
:type url: :py:class:`str`
:param queryparams: The query string parameters
queryparams['fields'] =... |
def create(self, workflow_id, data):
"""
Remove a subscriber from a specific Automation workflow. You can
remove a subscriber at any point in an Automation workflow, regardless
of how many emails they’ve been sent from that workflow. Once they’re
removed, they can never be added ... |
def all(self, workflow_id):
"""
Get information about subscribers who were removed from an Automation
workflow.
:param workflow_id: The unique id for the Automation workflow.
:type workflow_id: :py:class:`str`
"""
self.workflow_id = workflow_id
return sel... |
def create(self, list_id, data):
"""
Create a new webhook for a specific list.
The documentation does not include any required request body
parameters but the url parameter is being listed here as a required
parameter in documentation and error-checking based on the description
... |
def get(self, list_id, webhook_id):
"""
Get information about a specific webhook.
:param list_id: The unique id for the list.
:type list_id: :py:class:`str`
:param webhook_id: The unique id for the webhook.
:type webhook_id: :py:class:`str`
"""
self.list_... |
def update(self, list_id, webhook_id, data):
"""
Update the settings for an existing webhook.
:param list_id: The unique id for the list
:type list_id: :py:class:`str`
:param webhook_id: The unique id for the webhook
:type webhook_id: :py:class:`str`
"""
... |
def delete(self, list_id, webhook_id):
"""
Delete a specific webhook in a list.
:param list_id: The unique id for the list.
:type list_id: :py:class:`str`
:param webhook_id: The unique id for the webhook.
:type webhook_id: :py:class:`str`
"""
self.list_id... |
def all(self, list_id, **queryparams):
"""
returns the first 10 segments for a specific list.
"""
return self._mc_client._get(url=self._build_path(list_id, 'segments'), **queryparams) |
def get(self, list_id, segment_id):
"""
returns the specified list segment.
"""
return self._mc_client._get(url=self._build_path(list_id, 'segments', segment_id)) |
def update(self, list_id, segment_id, data):
"""
updates an existing list segment.
"""
return self._mc_client._patch(url=self._build_path(list_id, 'segments', segment_id), data=data) |
def delete(self, list_id, segment_id):
"""
removes an existing list segment from the list. This cannot be undone.
"""
return self._mc_client._delete(url=self._build_path(list_id, 'segments', segment_id)) |
def create(self, list_id, data):
"""
adds a new segment to the list.
"""
return self._mc_client._post(url=self._build_path(list_id, 'segments'), data=data) |
def _post(self, url, data=None):
"""
Handle authenticated POST requests
:param url: The url for the endpoint including path parameters
:type url: :py:class:`str`
:param data: The request body parameters
:type data: :py:data:`none` or :py:class:`dict`
:returns: Th... |
def get_metadata(self):
"""
Get the metadata returned after authentication
"""
try:
r = requests.get('https://login.mailchimp.com/oauth2/metadata', auth=self)
except requests.exceptions.RequestException as e:
raise e
else:
r.raise_for_s... |
def update(self, campaign_id, data):
"""
Set the content for a campaign.
:param campaign_id: The unique id for the campaign.
:type campaign_id: :py:class:`str`
:param data: The request body parameters
:type data: :py:class:`dict`
"""
self.campaign_id = ca... |
def get(self, conversation_id, **queryparams):
"""
Get details about an individual conversation.
:param conversation_id: The unique id for the conversation.
:type conversation_id: :py:class:`str`
:param queryparams: The query string parameters
queryparams['fields'] = []
... |
def all(self, campaign_id, get_all=False, **queryparams):
"""
Get information about members who have unsubscribed from a specific
campaign.
:param campaign_id: The unique id for the campaign.
:type campaign_id: :py:class:`str`
:param get_all: Should the query get all res... |
def all(self, template_id, **queryparams):
"""
Get the sections that you can edit in a template, including each
section’s default content.
:param template_id: The unique id for the template.
:type template_id: :py:class:`str`
:param queryparams: The query string paramete... |
def create(self, workflow_id, email_id, data):
"""
Manually add a subscriber to a workflow, bypassing the default trigger
settings. You can also use this endpoint to trigger a series of
automated emails in an API 3.0 workflow type or add subscribers to an
automated email queue th... |
def all(self, workflow_id, email_id):
"""
Get information about an Automation email queue.
:param workflow_id: The unique id for the Automation workflow.
:type workflow_id: :py:class:`str`
:param email_id: The unique id for the Automation workflow email.
:type email_id: ... |
def get(self, workflow_id, email_id, subscriber_hash):
"""
Get information about a specific subscriber in an Automation email
queue.
:param workflow_id: The unique id for the Automation workflow.
:type workflow_id: :py:class:`str`
:param email_id: The unique id for the A... |
def cancel(self, campaign_id):
"""
Cancel a Regular or Plain-Text Campaign after you send, before all of
your recipients receive it. This feature is included with MailChimp
Pro.
:param campaign_id: The unique id for the campaign.
:type campaign_id: :py:class:`str`
... |
def pause(self, campaign_id):
"""
Pause an RSS-Driven campaign.
:param campaign_id: The unique id for the campaign.
:type campaign_id: :py:class:`str`
"""
self.campaign_id = campaign_id
return self._mc_client._post(url=self._build_path(campaign_id, 'actions/pause... |
def replicate(self, campaign_id):
"""
Replicate a campaign in saved or send status.
:param campaign_id: The unique id for the campaign.
:type campaign_id: :py:class:`str`
"""
self.campaign_id = campaign_id
return self._mc_client._post(url=self._build_path(campaig... |
def resume(self, campaign_id):
"""
Resume an RSS-Driven campaign.
:param campaign_id: The unique id for the campaign.
:type campaign_id: :py:class:`str`
"""
self.campaign_id = campaign_id
return self._mc_client._post(url=self._build_path(campaign_id, 'actions/res... |
def schedule(self, campaign_id, data):
"""
Schedule a campaign for delivery. If you’re using Multivariate
Campaigns to test send times or sending RSS Campaigns, use the send
action instead.
:param campaign_id: The unique id for the campaign.
:type campaign_id: :py:class:... |
def send(self, campaign_id):
"""
Send a MailChimp campaign. For RSS Campaigns, the campaign will send
according to its schedule. All other campaigns will send immediately.
:param campaign_id: The unique id for the campaign.
:type campaign_id: :py:class:`str`
"""
... |
def unschedule(self, campaign_id):
"""
Unschedule a scheduled campaign that hasn’t started sending.
:param campaign_id: The unique id for the campaign.
:type campaign_id: :py:class:`str`
"""
self.campaign_id = campaign_id
return self._mc_client._post(url=self._bu... |
def create(self, store_id, data):
"""
Add a new customer to a store.
:param store_id: The store id.
:type store_id: :py:class:`str`
:param data: The request body parameters
:type data: :py:class:`dict`
data = {
"id": string*,
"email_addres... |
def get(self, store_id, customer_id, **queryparams):
"""
Get information about a specific customer.
:param store_id: The store id.
:type store_id: :py:class:`str`
:param customer_id: The id for the customer of a store.
:type customer_id: :py:class:`str`
:param qu... |
def create_or_update(self, store_id, customer_id, data):
"""
Add or update a customer.
:param store_id: The store id.
:type store_id: :py:class:`str`
:param customer_id: The id for the customer of a store.
:type customer_id: :py:class:`str`
:param data: The reque... |
def create_or_update(self, store_id, product_id, variant_id, data):
"""
Add or update a product variant.
:param store_id: The store id.
:type store_id: :py:class:`str`
:param product_id: The id for the product of a store.
:type product_id: :py:class:`str`
:param ... |
def create(self, campaign_id, data, **queryparams):
"""
Add feedback on a specific campaign.
:param campaign_id: The unique id for the campaign.
:type campaign_id: :py:class:`str`
:param data: The request body parameters
:type data: :py:class:`dict`
data = {
... |
def update(self, campaign_id, feedback_id, data):
"""
Update a specific feedback message for a campaign.
:param campaign_id: The unique id for the campaign.
:type campaign_id: :py:class:`str`
:param feedback_id: The unique id for the feedback message.
:type feedback_id: ... |
def create(self, list_id, data):
"""
Add a new merge field for a specific list.
:param list_id: The unique id for the list.
:type list_id: :py:class:`str`
:param data: The request body parameters
:type data: :py:class:`dict`
data = {
"name": string*,
... |
def get(self, list_id, merge_id):
"""
Get information about a specific merge field in a list.
:param list_id: The unique id for the list.
:type list_id: :py:class:`str`
:param merge_id: The id for the merge field.
:type merge_id: :py:class:`str`
"""
self.... |
def get(self, batch_webhook_id, **queryparams):
"""
Get information about a specific batch webhook.
:param batch_webhook_id: The unique id for the batch webhook.
:type batch_webhook_id: :py:class:`str`
:param queryparams: The query string parameters
queryparams['fields']... |
def update(self, batch_webhook_id, data):
"""
Update a webhook that will fire whenever any batch request completes
processing.
:param batch_webhook_id: The unique id for the batch webhook.
:type batch_webhook_id: :py:class:`str`
:param data: The request body parameters
... |
def delete(self, batch_webhook_id):
"""
Remove a batch webhook. Webhooks will no longer be sent to the given
URL.
:param batch_webhook_id: The unique id for the batch webhook.
:type batch_webhook_id: :py:class:`str`
"""
self.batch_webhook_id = batch_webhook_id
... |
def all(self, list_id, subscriber_hash, **queryparams):
"""
Get the last 50 events of a member’s activity on a specific list,
including opens, clicks, and unsubscribes.
:param list_id: The unique id for the list.
:type list_id: :py:class:`str`
:param subscriber_hash: The... |
def create(self, data):
"""
Add a new store to your MailChimp account.
Error checking on the currency code verifies that it is in the correct
three-letter, all-caps format as specified by ISO 4217 but does not
check that it is a valid code as the list of valid codes changes over... |
def update(self, store_id, data):
"""
Update a store.
:param store_id: The store id.
:type store_id: :py:class:`str`
:param data: The request body parameters
:type data: :py:class:`dict`
"""
self.store_id = store_id
return self._mc_client._patch(u... |
def create(self, store_id, product_id, data):
"""
Add a new image to the product.
:param store_id: The store id.
:type store_id: :py:class:`str`
:param product_id: The id for the product of a store.
:type product_id: :py:class:`str`
:param data: The request body ... |
def all(self, store_id, product_id, get_all=False, **queryparams):
"""
Get information about a product’s images.
:param store_id: The store id.
:type store_id: :py:class:`str`
:param product_id: The id for the product of a store.
:type product_id: :py:class:`str`
... |
def get(self, store_id, product_id, image_id, **queryparams):
"""
Get information about a specific product image.
:param store_id: The store id.
:type store_id: :py:class:`str`
:param product_id: The id for the product of a store.
:type product_id: :py:class:`str`
... |
def create(self, conversation_id, data):
"""
Post a new message to a conversation.
:param conversation_id: The unique id for the conversation.
:type conversation_id: :py:class:`str`
:param data: The request body parameters
:type data: :py:class:`dict`
data = {
... |
def create(self, store_id, data):
"""
Add a new order to a store.
:param store_id: The store id.
:type store_id: :py:class:`str`
:param data: The request body parameters
:type data: :py:class:`dict`
data = {
"id": string*,
"customer": obje... |
def create(self, list_id, subscriber_hash, data):
"""
Add a new note for a specific subscriber.
The documentation lists only the note request body parameter so it is
being documented and error-checked as if it were required based on the
description of the method.
:param... |
def update(self, list_id, subscriber_hash, data):
"""
Update tags for a specific subscriber.
The documentation lists only the tags request body parameter so it is
being documented and error-checked as if it were required based on the
description of the method.
The data ... |
def update(self, list_id, segment_id, data):
"""
Update a specific segment in a list.
:param list_id: The unique id for the list.
:type list_id: :py:class:`str`
:param segment_id: The unique id for the segment.
:type segment_id: :py:class:`str`
:param data: The r... |
def update_members(self, list_id, segment_id, data):
"""
Batch add/remove list members to static segment.
:param list_id: The unique id for the list.
:type list_id: :py:class:`str`
:param segment_id: The unique id for the segment.
:type segment_id: :py:class:`str`
... |
def create(self, list_id, category_id, data):
"""
Create a new interest or ‘group name’ for a specific category.
The documentation lists only the name request body parameter so it is
being documented and error-checked as if it were required based on the
description of the method... |
def update(self, list_id, category_id, interest_id, data):
"""
Update interests or ‘group names’ for a specific category.
:param list_id: The unique id for the list.
:type list_id: :py:class:`str`
:param category_id: The unique id for the interest category.
:type categor... |
def get(self, list_id, month, **queryparams):
"""
Get a summary of a specific list’s growth activity for a specific month and year.
:param list_id: The unique id for the list.
:type list_id: :py:class:`str`
:param month: A specific month of list growth history.
:type mon... |
def update(self, folder_id, data):
"""
Update a specific folder used to organize templates.
:param folder_id: The unique id for the File Manager folder.
:type folder_id: :py:class:`str`
:param data: The request body parameters
:type data: :py:class:`dict`
data = ... |
def create(self, list_id, data):
"""
Add a new member to the list.
:param list_id: The unique id for the list.
:type list_id: :py:class:`str`
:param data: The request body parameters
:type data: :py:class:`dict`
data = {
"status": string*, (Must be on... |
def update(self, list_id, subscriber_hash, data):
"""
Update information for a specific list member.
:param list_id: The unique id for the list.
:type list_id: :py:class:`str`
:param subscriber_hash: The MD5 hash of the lowercase version of the
list member’s email ad... |
def create_or_update(self, list_id, subscriber_hash, data):
"""
Add or update a list member.
:param list_id: The unique id for the list.
:type list_id: :py:class:`str`
:param subscriber_hash: The MD5 hash of the lowercase version of the
list member’s email address.
... |
def delete(self, list_id, subscriber_hash):
"""
Delete a member from a list.
:param list_id: The unique id for the list.
:type list_id: :py:class:`str`
:param subscriber_hash: The MD5 hash of the lowercase version of the
list member’s email address.
:type subsc... |
def delete_permanent(self, list_id, subscriber_hash):
"""
Delete permanently a member from a list.
:param list_id: The unique id for the list.
:type list_id: :py:class:`str`
:param subscriber_hash: The MD5 hash of the lowercase version of the
list member’s email addres... |
def get(self, workflow_id, **queryparams):
"""
Get a summary of an individual Automation workflow’s settings and
content. The trigger_settings object returns information for the first
email in the workflow.
:param workflow_id: The unique id for the Automation workflow
:t... |
def pause(self, workflow_id, email_id):
"""
Pause an automated email.
:param workflow_id: The unique id for the Automation workflow.
:type workflow_id: :py:class:`str`
:param email_id: The unique id for the Automation workflow email.
:type email_id: :py:class:`str`
... |
def start(self, workflow_id, email_id):
"""
Start an automated email.
:param workflow_id: The unique id for the Automation workflow.
:type workflow_id: :py:class:`str`
:param email_id: The unique id for the Automation workflow email.
:type email_id: :py:class:`str`
... |
def delete(self, workflow_id, email_id):
"""
Removes an individual Automation workflow email.
:param workflow_id: The unique id for the Automation workflow.
:type workflow_id: :py:class:`str`
:param email_id: The unique id for the Automation workflow email.
:type email_i... |
def create(self, data):
"""
Create a new MailChimp campaign.
The ValueError raised by an invalid type in data does not mention
'absplit' as a potential value because the documentation indicates
that the absplit type has been deprecated.
:param data: The request body par... |
def update(self, campaign_id, data):
"""
Update some or all of the settings for a specific campaign.
:param campaign_id: The unique id for the campaign.
:type campaign_id: :py:class:`str`
:param data: The request body parameters
:type data: :py:class:`dict`
data ... |
def delete(self, campaign_id):
"""
Remove a campaign from your MailChimp account.
:param campaign_id: The unique id for the campaign.
:type campaign_id: :py:class:`str`
"""
self.campaign_id = campaign_id
return self._mc_client._delete(url=self._build_path(campaig... |
def delete(self, store_id, cart_id, line_id):
"""
Delete a cart.
:param store_id: The store id.
:type store_id: :py:class:`str`
:param cart_id: The id for the cart.
:type cart_id: :py:class:`str`
:param line_id: The id for the line item of a cart.
:type l... |
def create(self, data):
"""
Begin processing a batch operations request.
:param data: The request body parameters
:type data: :py:class:`dict`
data = {
"operations": array*
[
{
"method": string* (Must be one of "GET", "... |
def all(self, get_all=False, **queryparams):
"""
Get a summary of batch requests that have been made.
:param get_all: Should the query get all results
:type get_all: :py:class:`bool`
:param queryparams: The query string parameters
queryparams['fields'] = []
query... |
def get(self, batch_id, **queryparams):
"""
Get the status of a batch request.
:param batch_id: The unique id for the batch operation.
:type batch_id: :py:class:`str`
:param queryparams: The query string parameters
queryparams['fields'] = []
queryparams['exclude_... |
def delete(self, batch_id):
"""
Stops a batch request from running. Since only one batch request is
run at a time, this can be used to cancel a long running request. The
results of any completed operations will not be available after this
call.
:param batch_id: The uniqu... |
def _reformat_policy(policy):
"""
Policies returned from boto3 are massive, ugly, and difficult to read.
This method flattens and reformats the policy.
:param policy: Result from invoking describe_load_balancer_policies(...)
:return: Returns a tuple containing policy_name and the reformatted policy... |
def _flatten_listener(listener):
"""
from
{
"Listener": {
"InstancePort": 80,
"LoadBalancerPort": 80,
"Protocol": "HTTP",
"InstanceProtocol": "HTTP"
},
"PolicyNames": []
},
to
{
"InstancePort": 80,
"LoadBalancerPort": 80,
... |
def get_load_balancer(load_balancer, flags=FLAGS.ALL ^ FLAGS.POLICY_TYPES, **conn):
"""
Fully describes an ELB.
:param loadbalancer: Could be an ELB Name or a dictionary. Likely the return value from a previous call to describe_load_balancers. At a minimum, must contain a key titled 'LoadBalancerName'.
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.