def submit():
    looker = LookerApi(client_id, client_secret, api_endpoint)
    c = looker.get_look(528)
    channel_list = [d['channel_dimensions.organization'] for d in c]
    market_list = get_markets_list(looker)
    subtype_list = get_channel_subtype_list(looker)

    return render_template('submit.html',
                           channel_list=channel_list,
                           market_list=market_list,
                           subtype_list=subtype_list)
Ejemplo n.º 2
0
    def generate_rows(self,
                      dataset_schema=None,
                      dataset_partitioning=None,
                      partition_id=None,
                      records_limit=-1):

        looker = LookerApi(host=self.baseurl,
                           token=self.clientid,
                           secret=self.clientsecret)

        data = looker.get_look(self.lookid, "json", limit=5000)

        for row in data:
            yield row

        #print(data)

        ### ------- Done -------

        #print("Done")
        """
Ejemplo n.º 3
0
### ------- HERE ARE PARAMETERS TO CONFIGURE -------

look_to_get = sys.argv[1]
host = 'localhost'


### ------- OPEN THE CONFIG FILE and INSTANTIATE API -------

f = open('config.yml')
params = yaml.load(f)
f.close()

my_host = params['hosts'][host]['host']
my_secret = params['hosts'][host]['secret']
my_token = params['hosts'][host]['token']

looker = LookerApi(host=my_host,
                 token=my_token,
                 secret = my_secret)


### ------- GET AND PRINT THE LOOK -------

data = looker.get_look(look_to_get)

pprint(data)

### ------- Done -------

print "Done"
Ejemplo n.º 4
0
### ------- HERE ARE PARAMETERS TO CONFIGURE -------

look_to_get = 123
host = 'localhost'


### ------- OPEN THE CONFIG FILE and INSTANTIATE API -------

f = open('config.yml')
params = yaml.load(f)
f.close()

my_host = params['hosts'][host]['host']
my_secret = params['hosts'][host]['secret']
my_token = params['hosts'][host]['token']

looker = LookerApi(host=my_host,
                 token=my_token,
                 secret = my_secret)


### ------- GET AND PRINT THE LOOK -------

data = looker.get_look()

pprint(data)

### ------- Done -------

print "Done"
my_host = params['hosts'][host]['host']
my_secret = params['hosts'][host]['secret']
my_token = params['hosts'][host]['token']

looker = LookerApi(host=my_host, token=my_token, secret=my_secret)

# These Look IDs should be updated to match the Look ID of
# whatever the new reports will be.

author_report = 157
task_report = 158

# get emails from a Look(157) (Author Report)
print "Getting Look information"
emails = looker.get_look(author_report)
email_list = []
for email in emails:
    for key, value in email.iteritems():
        email_list.append(value)

print "Getting Schedule information from Look"
# get look plan ID from a Look(158).
look_plan_id = looker.get_look_schedule(task_report)[0]['id']

# Pass those emails into an update_schedule call using the above look_plan_id into below plan
# Loop through the email list, appending to and creating and concatenating the string to be used for the
# body of the API call in json form
i = 1
list_of_schedule_plan_destinations = ''