Python config.API_KEY Examples

The following are 5 code examples of config.API_KEY(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module config , or try the search function .
Example #1
Source File: create-cluster.py    From listenbrainz-server with GNU General Public License v2.0 6 votes vote down vote up
def start_cluster(count):

    print("Connect to hetzner API...")
    configuration = HetznerCloudClientConfiguration().with_api_key(API_KEY).with_api_version(1)
    client = HetznerCloudClient(configuration)

    print("Create servers...")
    servers = []
    for i in range(count):
        server_a, create_action = client.servers().create(name="worker%03d" % i,
                server_type=SERVER_TYPE_8CPU_32GB,
                image=IMAGE_UBUNTU_1804, 
                start_after_create=True,
                ssh_keys=["robert", "zas", "param"],
                datacenter=DATACENTER_HELSINKI_1,
                user_data=START_SCRIPT)
        servers.append((server_a, create_action))

    print("Servers created, waiting to start....")
    for server, action in servers:
        server.wait_until_status_is(SERVER_STATUS_RUNNING) 
        print("   %s" % server.public_net_ipv4)
        sleep(1)

    print("Done.") 
Example #2
Source File: baidu.py    From ArknightsAutoHelper with MIT License 6 votes vote down vote up
def baidu_ocr(img, options, line=0):
    """
    调用百度api进行图片识别
    :param options: 百度ocr选项
    :param img: 获取图片
    :param line: 选择行数,暂时没有用途,以防万一留下这个变量,默认为第一行
    :return: 返回识别结果
    """
    client = AipOcr(APP_ID, API_KEY, SECRET_KEY)
    image = img
    """ 调用通用文字识别, 图片参数为本地图片 """
    result = client.basicGeneral(image, _options(options))

    if result["words_result_num"] > 1 or line >= 1:
        # TODO
        raise NotImplementedError
    elif result["words_result_num"] == 1:
        return result["words_result"][line]["words"]
    else:
        return "" 
Example #3
Source File: base.py    From ArknightsAutoHelper with MIT License 6 votes vote down vote up
def __print_info(self):
        logger.info('当前系统信息:')
        logger.info('ADB 服务器:\t%s:%d', *config.ADB_SERVER)
        logger.info('分辨率:\t%dx%d', *self.viewport)
        logger.info('OCR 引擎:\t%s', ocr.engine.info)
        logger.info('截图路径 (legacy):\t%s', config.SCREEN_SHOOT_SAVE_PATH)
        logger.info('存储路径 (legacy):\t%s', config.STORAGE_PATH)

        if config.enable_baidu_api:
            logger.info('%s',
                        """百度API配置信息:
        APP_ID\t{app_id}
        API_KEY\t{api_key}
        SECRET_KEY\t{secret_key}
                        """.format(
                            app_id=config.APP_ID, api_key=config.API_KEY, secret_key=config.SECRET_KEY
                        )
                        ) 
Example #4
Source File: fivetran_api.py    From functions with MIT License 5 votes vote down vote up
def get_url(url):
    return requests.get(url, auth=(API_KEY, API_SECRET)) 
Example #5
Source File: fivetran_api.py    From functions with MIT License 5 votes vote down vote up
def post_url(url, values):
    return requests.post(url, auth=(API_KEY, API_SECRET), json=values)