예제 #1
0
def updateShow(showID, appID, file):
    path = '%s%s%s' % (_STAGE_PATH, showID, _STAGE_PLAYLIST_PATH_PART)
    # This should be updated to be the correct host (hardcoded for now)
    url = '%s%s' % (_VAPI_ENVIRONMENT, path)

    headers = vams.headersWith(path, 'POST')
    headers['content-type'] = 'application/json'
    data = []

    with file:
        reader = csv.DictReader(file, delimiter=',')
        for row in reader:
            rowPayload = {
                'priority': 0,
                'stage_content_rule_id': 2,
                'args': row['contentID'],
                'duration': row['duration']
            }
            data.append(rowPayload)
    response = requests.post(url, data=json.dumps(data), headers=headers)
    if response.status_code == requests.codes.ok:
        print 'Success!'
        print response.json()
    else:
        print 'failure: '
        print response.status_code
예제 #2
0
def sendToVIP(appID, contentID):
    # Calculate request hash
    path = '%s%s%s%s' % (_STAGE_PATH_BEGINNING, appID, _SEND_TO_VIP_PATH_PART,
                         contentID)
    url = '%s%s' % (_VAPI_ENVIRONMENT, path)
    headers = vams.headersWith(path, 'POST')
    response = requests.post(url, data=None, headers=headers)

    if response.status_code == requests.codes.ok:
        print 'Success!'
        print response.json()
    else:
        print 'failure: '
        print response.status_code
예제 #3
0
def scheduleShow(showID, appID, stage, startTime):
    path = '/v1/stage/schedule_show'
    url = '%s%s' % (_VAPI_ENVIRONMENT, path)

    headers = vams.headersWith(path, 'POST')
    headers['content-type'] = 'application/json'

    data = {'stage_show_id': showID, 'stage': stage, 'start_time': startTime}

    response = requests.post(url, data=json.dumps(data), headers=headers)
    if response.status_code == requests.codes.ok:
        print 'Success!'
        print response.json()
    else:
        print 'failure: '
        print response.status_code
예제 #4
0
def createShow(showName, appID):
    # This should be updated to be the correct host (hardcoded for now)
    url = '%s%s' % (_VAPI_ENVIRONMENT, _STAGE_PATH)
    headers = vams.headersWith(_STAGE_PATH, 'POST')
    headers['content-type'] = 'application/json'
    data = {
        "title": showName,
        "app_id": appID
    }

    response = requests.post(url, data=json.dumps(data), headers=headers)
    if response.status_code == requests.codes.ok:
        print 'Success!'
        print response.json()
    else:
        print 'failure: '
        print response.status_code