本文整理汇总了Python中config.VERSION属性的典型用法代码示例。如果您正苦于以下问题:Python config.VERSION属性的具体用法?Python config.VERSION怎么用?Python config.VERSION使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类config
的用法示例。
在下文中一共展示了config.VERSION属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Init
# 需要导入模块: import config [as 别名]
# 或者: from config import VERSION [as 别名]
def Init(self):
self._CanvasHWND = self._Screen._CanvasHWND
self._Width = self._Screen._Width
self._Height = self._Screen._Height
self._ConfirmPage = UpdateConfirmPage()
self._ConfirmPage._Screen = self._Screen
self._ConfirmPage._Name = "Update Confirm"
self._ConfirmPage._Parent = self
self._ConfirmPage.Init()
it = {}
it["key"] = "version"
it["label"] = "Version"
it["value"] = config.VERSION
self._AList["version"] = it
self.GenList()
示例2: register_extensions
# 需要导入模块: import config [as 别名]
# 或者: from config import VERSION [as 别名]
def register_extensions(app):
db.init_app(app)
executor.init_app(app)
basic_auth.init_app(app)
@app.before_request
def enable_form_raw_cache():
# Workaround to allow unparsed request body to be be read from cache
# This is required to validate a signature on webhooks
# This MUST go before Sentry integration as sentry triggers form parsing
if not config.IS_TEST and (
request.path.startswith('/api/v1/slack/') or request.path.startswith('/api/v1/poli_payments_webhook/')):
if request.content_length > 1024 * 1024: # 1mb
# Payload too large
return make_response(jsonify({'message': 'Payload too large'})), 413
request.get_data(parse_form_data=False, cache=True)
# limiter.init_app(app)
CORS(app, resources={r"/api/*": {"origins": "*"}})
celery_app.conf.update(app.config)
if not config.IS_TEST:
sentry_sdk.init(app.config['SENTRY_SERVER_DSN'], integrations=[FlaskIntegration()], release=config.VERSION)
print('celery joined on {} at {}'.format(
app.config['REDIS_URL'], datetime.utcnow()))
示例3: nodeinfo
# 需要导入模块: import config [as 别名]
# 或者: from config import VERSION [as 别名]
def nodeinfo() -> Any:
"""NodeInfo endpoint."""
q = {
"box": Box.OUTBOX.value,
"meta.deleted": False,
"type": {"$in": [ap.ActivityType.CREATE.value, ap.ActivityType.ANNOUNCE.value]},
}
out = {
"version": "2.1",
"software": {
"name": "microblogpub",
"version": config.VERSION,
"repository": "https://github.com/tsileo/microblog.pub",
},
"protocols": ["activitypub"],
"services": {"inbound": [], "outbound": []},
"openRegistrations": False,
"usage": {"users": {"total": 1}, "localPosts": DB.activities.count(q)},
"metadata": {
"nodeName": f"@{config.USERNAME}@{config.DOMAIN}",
"version": config.VERSION,
"versionDate": config.VERSION_DATE,
},
}
return jsonify(
out,
"application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.1#",
)
示例4: CheckUpdate
# 需要导入模块: import config [as 别名]
# 或者: from config import VERSION [as 别名]
def CheckUpdate(self):
global LauncherLoc
self._Screen._MsgBox.SetText("CheckingUpdate")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
try:
r = requests.get(config.UPDATE_URL, verify=False, timeout=8)
except:
print("requests get error")
return
else:
if r.status_code == requests.codes.ok:
try:
json_ = r.json()
if "version" in json_ and "updatepath" in json_ and "md5sum" in json_:
if config.VERSION != json_["version"]:
self._ConfirmPage._URL = json_["updatepath"]
self._ConfirmPage._MD5 = json_["md5sum"]
self._ConfirmPage._GIT = False
self._Screen.PushPage(self._ConfirmPage)
self._Screen.Draw()
self._ConfirmPage.SnapMsg(MyLangManager.Tr("ConfirmUpdateToFQ") % json_["version"] )
self._Screen.SwapAndShow()
elif "gitversion" in json_: ### just use git to run update
cur_dir = os.getcwd()
os.chdir(LauncherLoc)
current_git_version = get_git_revision_short_hash()
current_git_version = current_git_version.strip("\n")
current_git_version = current_git_version.strip("\t")
os.chdir(cur_dir)
if current_git_version != json_["gitversion"]:
self._ConfirmPage._URL = None
self._ConfirmPage._MD5 = None
self._ConfirmPage._GIT = True
self._ConfirmPage._Version = json_["gitversion"]
self._Screen.PushPage(self._ConfirmPage)
self._Screen.Draw()
self._ConfirmPage.SnapMsg(MyLangManager.Tr("UpdateToFQ") % json_["gitversion"] )
self._Screen.SwapAndShow()
else:
self._Screen.Draw()
self._Screen._MsgBox.SetText("LauncherIsUpToDate")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
pygame.time.delay(765)
return True
except Exception, e:
print("r.json() error %s" % str(e))
else: