This commit is contained in:
Vladislav 2026-07-20 14:34:08 -04:00
parent dc2d793dd9
commit d6999e4e5e
4 changed files with 48 additions and 22 deletions

View File

@ -602,7 +602,6 @@
" \"post\": post,\n", " \"post\": post,\n",
" **prod_filter\n", " **prod_filter\n",
" }\n", " }\n",
" print(new_doc)\n",
"\n", "\n",
" tasks.append(delivery_collection.update_one(\n", " tasks.append(delivery_collection.update_one(\n",
" {**prod_filter, \"status\": \"На выставке\", \"post_id\": post_id, \"exhibition_id\": exhibition_id},\n", " {**prod_filter, \"status\": \"На выставке\", \"post_id\": post_id, \"exhibition_id\": exhibition_id},\n",
@ -4649,22 +4648,16 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "c7dc7c3e", "id": "c7dc7c3e",
"metadata": {}, "metadata": {
"vscode": {
"languageId": "shellscript"
}
},
"outputs": [], "outputs": [],
"source": [ "source": [
"!uvicorn main:app --host 0.0.0.0 --port 8005 --reload" "!uvicorn main:app --host 0.0.0.0 --port 8005 --reload"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"id": "20665cd7",
"metadata": {},
"outputs": [],
"source": [
"stop"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
@ -4688,7 +4681,11 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "a6f67f24", "id": "a6f67f24",
"metadata": {}, "metadata": {
"vscode": {
"languageId": "shellscript"
}
},
"outputs": [], "outputs": [],
"source": [ "source": [
"!pip freeze > req.txt" "!pip freeze > req.txt"

View File

@ -406,7 +406,6 @@ async def cron_every_five_min(token: str = Security(get_token)):
"post": post, "post": post,
**prod_filter **prod_filter
} }
print(new_doc)
tasks.append(delivery_collection.update_one( tasks.append(delivery_collection.update_one(
{**prod_filter, "status": "На выставке", "post_id": post_id, "exhibition_id": exhibition_id}, {**prod_filter, "status": "На выставке", "post_id": post_id, "exhibition_id": exhibition_id},

View File

@ -392,7 +392,7 @@
" try:\n", " try:\n",
" logging.info(f\"VK начало edit {item} {file_ids}\")\n", " logging.info(f\"VK начало edit {item} {file_ids}\")\n",
" res = httpx.post(\n", " res = httpx.post(\n",
" 'http://kultmost-api.kultmost/api/v1/social/vk/edit', \n", " 'http://127.0.0.1:30080/api/v1/social/vk/edit', \n",
" headers={\"Authorization\": f\"bearer {ATOKEN}\"}, \n", " headers={\"Authorization\": f\"bearer {ATOKEN}\"}, \n",
" json={'post_id': post_id, 'item': item, 'text': text, 'file_ids': file_ids, 'doc': social, 'sign_avatar': sign_avatar},\n", " json={'post_id': post_id, 'item': item, 'text': text, 'file_ids': file_ids, 'doc': social, 'sign_avatar': sign_avatar},\n",
" timeout=100\n", " timeout=100\n",
@ -427,7 +427,7 @@
" try:\n", " try:\n",
" logging.info(f\"VK удаления публикации {item} {post_id}\")\n", " logging.info(f\"VK удаления публикации {item} {post_id}\")\n",
" res = httpx.post(\n", " res = httpx.post(\n",
" 'http://kultmost-api.kultmost/api/v1/social/vk/delete',\n", " 'http://127.0.0.1:30080/api/v1/social/vk/delete',\n",
" headers={\"Authorization\": f\"bearer {ATOKEN}\"},\n", " headers={\"Authorization\": f\"bearer {ATOKEN}\"},\n",
" json={'item': item, 'post_id': post_id, \"doc\": doc},\n", " json={'item': item, 'post_id': post_id, \"doc\": doc},\n",
" timeout=100\n", " timeout=100\n",
@ -541,7 +541,11 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "6f76c7c1", "id": "6f76c7c1",
"metadata": {}, "metadata": {
"vscode": {
"languageId": "shellscript"
}
},
"outputs": [], "outputs": [],
"source": [ "source": [
"!celery -A vk.celery_app_vk worker --loglevel=info" "!celery -A vk.celery_app_vk worker --loglevel=info"
@ -551,7 +555,11 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "b0d41fb5", "id": "b0d41fb5",
"metadata": {}, "metadata": {
"vscode": {
"languageId": "shellscript"
}
},
"outputs": [], "outputs": [],
"source": [ "source": [
"!docker build -t registry.spiritofweb.ru/avtopost-api:latest ." "!docker build -t registry.spiritofweb.ru/avtopost-api:latest ."
@ -561,7 +569,11 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "674d49e8", "id": "674d49e8",
"metadata": {}, "metadata": {
"vscode": {
"languageId": "shellscript"
}
},
"outputs": [], "outputs": [],
"source": [ "source": [
"!sudo docker image push registry.spiritofweb.ru/avtopost-api:latest" "!sudo docker image push registry.spiritofweb.ru/avtopost-api:latest"
@ -571,12 +583,30 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "65b3c103", "id": "65b3c103",
"metadata": {}, "metadata": {
"vscode": {
"languageId": "shellscript"
}
},
"outputs": [], "outputs": [],
"source": [ "source": [
"!kubectl rollout restart deployments/vk-celery -n kultmost" "!kubectl rollout restart deployments/vk-celery -n kultmost"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"id": "79ce5429",
"metadata": {
"vscode": {
"languageId": "shellscript"
}
},
"outputs": [],
"source": [
"!echo $REGISTRY_HOST"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "62a866f8", "id": "62a866f8",

4
vk.py
View File

@ -301,7 +301,7 @@ def edit(self, post_id: int, item: dict, text: str, file_ids: list, social: dict
try: try:
logging.info(f"VK начало edit {item} {file_ids}") logging.info(f"VK начало edit {item} {file_ids}")
res = httpx.post( res = httpx.post(
'http://kultmost-api.kultmost/api/v1/social/vk/edit', 'http://127.0.0.1:30080/api/v1/social/vk/edit',
headers={"Authorization": f"bearer {ATOKEN}"}, headers={"Authorization": f"bearer {ATOKEN}"},
json={'post_id': post_id, 'item': item, 'text': text, 'file_ids': file_ids, 'doc': social, 'sign_avatar': sign_avatar}, json={'post_id': post_id, 'item': item, 'text': text, 'file_ids': file_ids, 'doc': social, 'sign_avatar': sign_avatar},
timeout=100 timeout=100
@ -329,7 +329,7 @@ def delete_wall(self, item: dict, post_id: int, doc: dict):
try: try:
logging.info(f"VK удаления публикации {item} {post_id}") logging.info(f"VK удаления публикации {item} {post_id}")
res = httpx.post( res = httpx.post(
'http://kultmost-api.kultmost/api/v1/social/vk/delete', 'http://127.0.0.1:30080/api/v1/social/vk/delete',
headers={"Authorization": f"bearer {ATOKEN}"}, headers={"Authorization": f"bearer {ATOKEN}"},
json={'item': item, 'post_id': post_id, "doc": doc}, json={'item': item, 'post_id': post_id, "doc": doc},
timeout=100 timeout=100