|
@ -226,9 +226,10 @@ def upload_to_qiniu(filename): |
|
|
|
|
|
|
|
|
# 获取 qiniu 配置参数 |
|
|
# 获取 qiniu 配置参数 |
|
|
qn_cfg = config['qiniu'] |
|
|
qn_cfg = config['qiniu'] |
|
|
access_key = qn_cfg['access-key'] |
|
|
access_key = os.environ.get('QINIU_AK', qn_cfg['access-key']) |
|
|
secret_key = qn_cfg['secret-key'] |
|
|
secret_key = os.environ.get('QINIU_SK', qn_cfg['secret-key']) |
|
|
bucket_name = qn_cfg['bucket'] |
|
|
bucket_name = os.environ.get('QINIU_BUCKET', qn_cfg['bucket']) |
|
|
|
|
|
domain = os.environ.get('QINIU_DOMAIN', qn_cfg['domain']) |
|
|
|
|
|
|
|
|
q = qiniu.Auth(access_key, secret_key) |
|
|
q = qiniu.Auth(access_key, secret_key) |
|
|
bucket = qiniu.BucketManager(q) |
|
|
bucket = qiniu.BucketManager(q) |
|
@ -252,7 +253,7 @@ def upload_to_qiniu(filename): |
|
|
print('上传成功') |
|
|
print('上传成功') |
|
|
logging.info('上传成功') |
|
|
logging.info('上传成功') |
|
|
# 获取文件访问 URL |
|
|
# 获取文件访问 URL |
|
|
url = '{}/{}?attname='.format(qn_cfg['domain'], ret['key']) |
|
|
url = '{}/{}?attname='.format(domain, ret['key']) |
|
|
print('文件访问 URL:', url) |
|
|
print('文件访问 URL:', url) |
|
|
logging.info('文件访问 URL:{}'.format(url)) |
|
|
logging.info('文件访问 URL:{}'.format(url)) |
|
|
else: |
|
|
else: |
|
@ -299,11 +300,11 @@ def generate_word_report(): |
|
|
def create_clickhouse_client(): |
|
|
def create_clickhouse_client(): |
|
|
# 获取 clickhouse 配置参数 |
|
|
# 获取 clickhouse 配置参数 |
|
|
ch_cfg = config['clickhouse'] |
|
|
ch_cfg = config['clickhouse'] |
|
|
host = ch_cfg['host'] |
|
|
host = os.environ.get('CLICKHOUSE_HOST', ch_cfg['host']) |
|
|
port = ch_cfg.getint('port') |
|
|
port = int(os.environ.get('CLICKHOUSE_PORT', ch_cfg.getint('port'))) |
|
|
username = ch_cfg['username'] |
|
|
username = os.environ.get('CLICKHOUSE_USERNAME', ch_cfg['username']) |
|
|
password = ch_cfg['password'] |
|
|
password = os.environ.get('CLICKHOUSE_PASSWORD', ch_cfg['password']) |
|
|
database = ch_cfg['database'] |
|
|
database = os.environ.get('CLICKHOUSE_DATABASE', ch_cfg['database']) |
|
|
# 创建 ClickHouse 客户端对象 |
|
|
# 创建 ClickHouse 客户端对象 |
|
|
return Client(host=host, port=port, user=username, password=password, database=database) |
|
|
return Client(host=host, port=port, user=username, password=password, database=database) |
|
|
|
|
|
|
|
|