fix tags
This commit is contained in:
12
news-bot.py
12
news-bot.py
@@ -22,7 +22,8 @@ url_changelog = "https://gitlab.eterfund.ru/Castro-Fidel/PortWINE/raw/master/dat
|
|||||||
heads_site = {
|
heads_site = {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"Api-Key": keys.api_key_site,
|
"Api-Key": keys.api_key_site,
|
||||||
"Api-Username": "linux-gaming"
|
"Api-Username": "linux-gaming",
|
||||||
|
"skip_validations": "true"
|
||||||
}
|
}
|
||||||
|
|
||||||
params_get = {
|
params_get = {
|
||||||
@@ -35,7 +36,7 @@ params_get = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.INFO)
|
||||||
|
|
||||||
handler = colorlog.StreamHandler()
|
handler = colorlog.StreamHandler()
|
||||||
handler.setFormatter(colorlog.ColoredFormatter(
|
handler.setFormatter(colorlog.ColoredFormatter(
|
||||||
@@ -176,8 +177,7 @@ def script_content(script_ver, resp_changelog):
|
|||||||
post_data = {
|
post_data = {
|
||||||
"title": f"Обновление скриптов {script_ver}",
|
"title": f"Обновление скриптов {script_ver}",
|
||||||
"raw": site_text,
|
"raw": site_text,
|
||||||
"category": keys.cat_num,
|
"category": keys.cat_num
|
||||||
"tags": ["scripts"]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return post_text, post_data, post_text
|
return post_text, post_data, post_text
|
||||||
@@ -245,8 +245,9 @@ def news():
|
|||||||
|
|
||||||
def site_post(url, headers, json):
|
def site_post(url, headers, json):
|
||||||
while True:
|
while True:
|
||||||
title = json.get('title', 'No title')
|
title = json.get('title')
|
||||||
try:
|
try:
|
||||||
|
print(json)
|
||||||
resp_post = requests.post(url=url, headers=headers, json=json)
|
resp_post = requests.post(url=url, headers=headers, json=json)
|
||||||
if resp_post.status_code == 200:
|
if resp_post.status_code == 200:
|
||||||
logging.info("Новость опубликована на сайте!")
|
logging.info("Новость опубликована на сайте!")
|
||||||
@@ -283,6 +284,7 @@ def check_version(last_changelog, resp_changelog):
|
|||||||
logging.info(f"Найдена новая версия скрипта {script_ver}")
|
logging.info(f"Найдена новая версия скрипта {script_ver}")
|
||||||
changelog_text, post_data, params = script_content(script_ver, resp_changelog)
|
changelog_text, post_data, params = script_content(script_ver, resp_changelog)
|
||||||
if post_data:
|
if post_data:
|
||||||
|
logging.debug(f"Публикуем {post_data}")
|
||||||
site_post(url_post, heads_site, post_data)
|
site_post(url_post, heads_site, post_data)
|
||||||
|
|
||||||
if not list_new_ver:
|
if not list_new_ver:
|
||||||
|
Reference in New Issue
Block a user