代码拉取完成,页面将自动刷新
同步操作将从 刘永杰/skong_invoice 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
# ini文件识别需要用的库
import os
from configparser import ConfigParser
import chardet # 需要安装库:pip install chardet
str = '''[软件配置.ini]
;***********************************************
API_Key = yrhFG4cV08IZl7FA0drSZUzI
Secret_Key = MZlngitpgepK0qWAbdD5uHDpL8jD2Z3G
;API_Key、Secret_Key这都是从百度云官方获取的。
;API_Key、Secret_Key获取方法:https://www.skong2015.com
;***********************************************
[水印功能]
Water_Word = 郑州上控电气技术有限公司
;水印文字自行修改,不想水印,什么都别填写就可以了。
;***********************************************'''
class SoftConfig(object):
# 编码方式读取
def get_encoding(self):
with open("软件配置.ini", 'rb') as f:
return chardet.detect(f.read())['encoding']
# 初始化配置
def __init__(self):
# 软件配置.ini 文件自动生成。
if not os.path.exists("软件配置.ini"):
with open("软件配置.ini", "w", encoding="utf-8") as f:
f.write(str)
# 获取一下,AK,SK。
parser = ConfigParser()
parser.read("软件配置.ini", encoding=self.get_encoding())
self.API_Key = parser.get("软件配置.ini", 'API_Key').strip()
self.Secret_Key = parser.get("软件配置.ini", 'Secret_Key').strip()
self.Water_Word = parser.get("水印功能", 'Water_Word').strip()
# 测试
if __name__ == '__main__':
s_cfg = SoftConfig()
print(s_cfg.API_Key)
print(s_cfg.Secret_Key)
print(s_cfg.Water_Word)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。