#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import requests
    
def get_video_url(id: str, protocol: str):
    video_url = ""
    api_url = "http://10.181.7.217:8081/previewURLs"
    params = {
        "cameraIndexCode": id,
        "protocol": protocol
    }
    print('param', params)
    response = requests.post(url=api_url, params=params, timeout=15)
    print(response.text)
    if response.status_code == 200:
        result = response.json()
        if result['errcode'] == 0:
            video_url = result['data']
    return video_url
