Exemplo n.º 1
0
    def __init__(self, *args, **kwargs):
        super(SailthruEmailBackend, self).__init__(*args, **kwargs)

        self.sailthru_client = sc.SailthruClient(
            settings.SAILTHRU_API_KEY,
            settings.SAILTHRU_API_SECRET,
        )
Exemplo n.º 2
0
def _get_client():
    """Retrieve the Sailthru API Client.

    Arguments:
        timeout: How many seconds the client should wait for an API
            call to return before aborting the request.
    """
    return sailthru_client.SailthruClient(sailthru_secrets.sailthru_key,
                                          sailthru_secrets.sailthru_secret)
Exemplo n.º 3
0
def _get_client():
    """Retrieve the Sailthru API Client.

    Arguments:
        timeout: How many seconds the client should wait for an API
            call to return before aborting the request.
    """
    return sailthru_client.SailthruClient(_SAILTHRU_KEY,
                                          _SAILTHRU_SECRET,
                                          timeout=40,
                                          retries=2)
Exemplo n.º 4
0
 def setUp(self):
     api_key = 'test'
     api_secret = 'super_secret'
     self.client = c.SailthruClient(api_key, api_secret)
Exemplo n.º 5
0
import argparse
import futures
import math
import os
import secrets
from sailthru import sailthru_client as sc
import shutil
import sys
import time

# The max file size (in bytes) a CSV can be for API upload to Sailthru.
# Check Sailthru for last max size.
SAILTHRU_MAX_SIZE = 10000000

# Initialize Sailthru client
sailthru_client = sc.SailthruClient(secrets.api_key, secrets.api_secret)


def main():
    parser = argparse.ArgumentParser(
        description='Upload an input CSV file to Sailthru.')
    parser.add_argument('input_file',
                        type=str,
                        help='the file to process and upload')
    parser.add_argument('--keep-files',
                        dest='keep_files',
                        action='store_const',
                        const=True,
                        default=False,
                        help='Keep intermediate split files after uploading')
    parser.add_argument('--split-only',