0
点赞
收藏
分享

微信扫一扫

电子学会C/C++编程等级考试2021年06月(三级)真题解析

import datetime
from requests_toolbelt import MultipartEncoder
from urllib import parse
import xlwt
import time
import pymssql
import requests
import json
from fake_useragent import UserAgent
import os  # 要想使用路径相关功能需要导入 os 模块
from apscheduler.schedulers.blocking import BlockingScheduler
import pytz
import logging
timezone = pytz.timezone('Asia/Shanghai')
scheduler = BlockingScheduler()
requests.adapters.DEFAULT_RETRIES = 5  # 增加重连次数
s = requests.session()
s.keep_alive = False
ua=UserAgent()
# 配置日志格式
logging.basicConfig(filename='downLoad.log', format='%(asctime)s - %(levelname)s - %(message)s', encoding='utf-8')
def read_db_config():
    BASE_DIR = os.path.abspath(__file__)
    a = BASE_DIR.split("\\")[:-2]
    fat = '/'.join(a)
    # 读取数据库配置文件
    with open(fat+'/config.json') as file:
        config = json.load(file)
    return config


class downLoad():
    def __init__(self) -> object:
        self.logger = logging.getLogger(__name__)
        self.sheet_name = 'report_' + time.strftime("%Y-%m-%d")
        self.filename = 'report_' + time
举报

相关推荐

0 条评论