hore
This commit is contained in:
parent
21a2d259f7
commit
0357ba5c93
172
build.ipynb
172
build.ipynb
@ -12,8 +12,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!pip install -r requirements.txt"
|
"!pip install -r requirements.txt"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -65,8 +64,7 @@
|
|||||||
"EOF\n",
|
"EOF\n",
|
||||||
"\n",
|
"\n",
|
||||||
"chmod +x .git/hooks/pre-commit\n"
|
"chmod +x .git/hooks/pre-commit\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -114,8 +112,7 @@
|
|||||||
" load_env('env')\n",
|
" load_env('env')\n",
|
||||||
"except:\n",
|
"except:\n",
|
||||||
" load_env('env_example')"
|
" load_env('env_example')"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -141,8 +138,7 @@
|
|||||||
"kubectl -n container-registry create secret generic registry-basic-auth \\\n",
|
"kubectl -n container-registry create secret generic registry-basic-auth \\\n",
|
||||||
" --from-file=auth=/tmp/registry.htpasswd \\\n",
|
" --from-file=auth=/tmp/registry.htpasswd \\\n",
|
||||||
" --dry-run=client -o yaml | kubectl apply -f -\n"
|
" --dry-run=client -o yaml | kubectl apply -f -\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -156,8 +152,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!kubectl create secret docker-registry regcred --docker-server=$REGISTRY_HOST --docker-username='user' --docker-password=$REGISTRY_PASS --docker-email=\"$(git config --global --get user.email)\""
|
"!kubectl create secret docker-registry regcred --docker-server=$REGISTRY_HOST --docker-username='user' --docker-password=$REGISTRY_PASS --docker-email=\"$(git config --global --get user.email)\""
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -172,8 +167,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"!kubectl create namespace kultmost\n",
|
"!kubectl create namespace kultmost\n",
|
||||||
"!kubectl create secret docker-registry regcred -n kultmost --docker-server=$REGISTRY_HOST --docker-username='user' --docker-password=$REGISTRY_PASS --docker-email=\"$(git config --global --get user.email)\""
|
"!kubectl create secret docker-registry regcred -n kultmost --docker-server=$REGISTRY_HOST --docker-username='user' --docker-password=$REGISTRY_PASS --docker-email=\"$(git config --global --get user.email)\""
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -187,8 +181,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!docker login $REGISTRY_HOST -u 'user' -p $REGISTRY_PASS"
|
"!docker login $REGISTRY_HOST -u 'user' -p $REGISTRY_PASS"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -210,8 +203,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!docker pull $REGISTRY_HOST/python:3.13-alpine"
|
"!docker pull $REGISTRY_HOST/python:3.13-alpine"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -225,8 +217,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!docker pull $REGISTRY_HOST/python:3.13-slim"
|
"!docker pull $REGISTRY_HOST/python:3.13-slim"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -266,8 +257,7 @@
|
|||||||
" f.write('\\n\\n'.join(app))\n",
|
" f.write('\\n\\n'.join(app))\n",
|
||||||
"\n",
|
"\n",
|
||||||
"build()"
|
"build()"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -285,8 +275,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!docker tag mongo:latest registry.spiritofweb.ru/mongo:latest"
|
"!docker tag mongo:latest registry.spiritofweb.ru/mongo:latest"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -300,8 +289,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!docker build -t $REGISTRY_HOST/api-tg:latest tg/."
|
"!docker build -t $REGISTRY_HOST/api-tg:latest tg/."
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -315,8 +303,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!docker push $REGISTRY_HOST/api-tg:latest"
|
"!docker push $REGISTRY_HOST/api-tg:latest"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -338,8 +325,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!docker build -t $REGISTRY_HOST/avtopost-api:latest ."
|
"!docker build -t $REGISTRY_HOST/avtopost-api:latest ."
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -353,8 +339,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!docker image push $REGISTRY_HOST/avtopost-api:latest"
|
"!docker image push $REGISTRY_HOST/avtopost-api:latest"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -368,8 +353,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!kubectl rollout restart deployments/kultmost-api -n kultmost"
|
"!kubectl rollout restart deployments/kultmost-api -n kultmost"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -391,8 +375,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!kubectl rollout restart deployments/vk-celery -n kultmost"
|
"!kubectl rollout restart deployments/vk-celery -n kultmost"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -406,8 +389,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!kubectl rollout restart deployments/email-celery -n kultmost"
|
"!kubectl rollout restart deployments/email-celery -n kultmost"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -432,8 +414,7 @@
|
|||||||
"docker pull gitea/gitea:1.22\n",
|
"docker pull gitea/gitea:1.22\n",
|
||||||
"docker tag gitea/gitea:1.22 $REGISTRY_HOST/gitea/gitea:1.22\n",
|
"docker tag gitea/gitea:1.22 $REGISTRY_HOST/gitea/gitea:1.22\n",
|
||||||
"docker push $REGISTRY_HOST/gitea/gitea:1.22"
|
"docker push $REGISTRY_HOST/gitea/gitea:1.22"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -457,8 +438,7 @@
|
|||||||
"docker tag busybox:1.36 $REGISTRY_HOST/busybox:1.36\n",
|
"docker tag busybox:1.36 $REGISTRY_HOST/busybox:1.36\n",
|
||||||
"docker tag rabbitmq:3.11-management $REGISTRY_HOST/rabbitmq:3.11-management\n",
|
"docker tag rabbitmq:3.11-management $REGISTRY_HOST/rabbitmq:3.11-management\n",
|
||||||
"docker tag alpine:3.14 $REGISTRY_HOST/alpine:3.14"
|
"docker tag alpine:3.14 $REGISTRY_HOST/alpine:3.14"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -477,8 +457,7 @@
|
|||||||
"docker push $REGISTRY_HOST/busybox:1.36\n",
|
"docker push $REGISTRY_HOST/busybox:1.36\n",
|
||||||
"docker push $REGISTRY_HOST/rabbitmq:3.11-management\n",
|
"docker push $REGISTRY_HOST/rabbitmq:3.11-management\n",
|
||||||
"docker push $REGISTRY_HOST/alpine:3.14"
|
"docker push $REGISTRY_HOST/alpine:3.14"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -500,8 +479,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!docker build -t $REGISTRY_HOST/ssh-tunnel:2 tunnel/"
|
"!docker build -t $REGISTRY_HOST/ssh-tunnel:2 tunnel/"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -515,8 +493,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!docker push $REGISTRY_HOST/ssh-tunnel:2"
|
"!docker push $REGISTRY_HOST/ssh-tunnel:2"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -530,8 +507,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!kubectl create secret generic ssh-id-rsa --from-file=id_rsa=/home/user/.ssh/id_rsa -n kultmost"
|
"!kubectl create secret generic ssh-id-rsa --from-file=id_rsa=/home/user/.ssh/id_rsa -n kultmost"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -545,8 +521,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!kubectl apply -n kultmost -f k8s/stunnel.yaml"
|
"!kubectl apply -n kultmost -f k8s/stunnel.yaml"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -568,8 +543,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!envsubst < k8s/prod.yaml | kubectl apply -n kultmost -f -"
|
"!envsubst < k8s/prod.yaml | kubectl apply -n kultmost -f -"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -583,8 +557,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!envsubst < k8s/kultmost.yaml | kubectl apply -n kultmost -f -"
|
"!envsubst < k8s/kultmost.yaml | kubectl apply -n kultmost -f -"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -598,8 +571,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!envsubst < k8s/mq.yaml | kubectl apply -n kultmost -f -"
|
"!envsubst < k8s/mq.yaml | kubectl apply -n kultmost -f -"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -613,8 +585,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!envsubst < k8s/gitea.yaml | kubectl apply -n gitea -f -"
|
"!envsubst < k8s/gitea.yaml | kubectl apply -n gitea -f -"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -628,8 +599,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!kubectl get pod -n kultmost"
|
"!kubectl get pod -n kultmost"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -654,8 +624,7 @@
|
|||||||
"echo \"$INIT_SSH'bash -s' <<'SCRIPT'\"\n",
|
"echo \"$INIT_SSH'bash -s' <<'SCRIPT'\"\n",
|
||||||
"echo \"kubectl create secret docker-registry regcred --docker-server=$REGISTRY_HOST --docker-username='user' --docker-password=$REGISTRY_PASS --docker-email=\\\"$(git config --global --get user.email)\\\" && clear && history -c && history -w\"\n",
|
"echo \"kubectl create secret docker-registry regcred --docker-server=$REGISTRY_HOST --docker-username='user' --docker-password=$REGISTRY_PASS --docker-email=\\\"$(git config --global --get user.email)\\\" && clear && history -c && history -w\"\n",
|
||||||
"echo \"SCRIPT\""
|
"echo \"SCRIPT\""
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -678,8 +647,7 @@
|
|||||||
"echo \"clear\"\n",
|
"echo \"clear\"\n",
|
||||||
"echo \"history -c\"\n",
|
"echo \"history -c\"\n",
|
||||||
"echo \"history -w\""
|
"echo \"history -w\""
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -701,8 +669,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!rsync -avz -ogp --chown=www-data:www-data ./static/ kultmost:/var/www/static/"
|
"!rsync -avz -ogp --chown=www-data:www-data ./static/ kultmost:/var/www/static/"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -716,8 +683,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!echo $(git branch --show-current)"
|
"!echo $(git branch --show-current)"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -731,8 +697,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!rsync -avh --exclude-from=.rsyncignore --exclude=.venv/ . kultmost:/app/$(git branch --show-current)/"
|
"!rsync -avh --exclude-from=.rsyncignore --exclude=.venv/ . kultmost:/app/$(git branch --show-current)/"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -770,8 +735,7 @@
|
|||||||
"EOF\n",
|
"EOF\n",
|
||||||
"\n",
|
"\n",
|
||||||
"ssh kultmost 'systemctl daemon-reload && systemctl enable --now production.service && systemctl status --no-pager -l production.service'\n"
|
"ssh kultmost 'systemctl daemon-reload && systemctl enable --now production.service && systemctl status --no-pager -l production.service'\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -801,8 +765,7 @@
|
|||||||
"EOF\n",
|
"EOF\n",
|
||||||
"\n",
|
"\n",
|
||||||
"ssh kultmost 'systemctl daemon-reload && systemctl enable --now fastapi.service && systemctl status --no-pager -l fastapi.service'\n"
|
"ssh kultmost 'systemctl daemon-reload && systemctl enable --now fastapi.service && systemctl status --no-pager -l fastapi.service'\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -840,8 +803,7 @@
|
|||||||
"EOF\n",
|
"EOF\n",
|
||||||
"\n",
|
"\n",
|
||||||
"ssh kultmost 'systemctl daemon-reload && systemctl enable --now staging.service && systemctl status --no-pager -l staging.service'\n"
|
"ssh kultmost 'systemctl daemon-reload && systemctl enable --now staging.service && systemctl status --no-pager -l staging.service'\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -877,8 +839,7 @@
|
|||||||
"[Install]\n",
|
"[Install]\n",
|
||||||
"WantedBy=default.target\n",
|
"WantedBy=default.target\n",
|
||||||
"EOF"
|
"EOF"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -908,8 +869,7 @@
|
|||||||
"EOF\n",
|
"EOF\n",
|
||||||
"\n",
|
"\n",
|
||||||
"ssh kultmost 'systemctl daemon-reload && systemctl enable --now staging.service && systemctl status --no-pager -l staging.service'\n"
|
"ssh kultmost 'systemctl daemon-reload && systemctl enable --now staging.service && systemctl status --no-pager -l staging.service'\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -931,8 +891,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!ssh kultmost 'systemctl restart production.service'"
|
"!ssh kultmost 'systemctl restart production.service'"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -946,8 +905,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!ssh kultmost 'systemctl status production.service'"
|
"!ssh kultmost 'systemctl status production.service'"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -961,8 +919,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!ssh kultmost 'systemctl restart fastapi.service'"
|
"!ssh kultmost 'systemctl restart fastapi.service'"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -976,8 +933,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!ssh kultmost 'systemctl status fastapi.service'"
|
"!ssh kultmost 'systemctl status fastapi.service'"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -1015,8 +971,7 @@
|
|||||||
"EOF\n",
|
"EOF\n",
|
||||||
"\n",
|
"\n",
|
||||||
"ssh kultmost 'systemctl daemon-reload && systemctl enable --now vk-celery.service && systemctl status --no-pager -l vk-celery.service'\n"
|
"ssh kultmost 'systemctl daemon-reload && systemctl enable --now vk-celery.service && systemctl status --no-pager -l vk-celery.service'\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1030,8 +985,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!ssh kultmost 'systemctl restart vk-celery.service'"
|
"!ssh kultmost 'systemctl restart vk-celery.service'"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1045,8 +999,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!ssh kultmost 'systemctl status vk-celery.service'"
|
"!ssh kultmost 'systemctl status vk-celery.service'"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1076,8 +1029,7 @@
|
|||||||
"EOF\n",
|
"EOF\n",
|
||||||
"\n",
|
"\n",
|
||||||
"ssh kultmost 'systemctl daemon-reload && systemctl enable --now email-celery.service && systemctl status --no-pager -l email-celery.service'\n"
|
"ssh kultmost 'systemctl daemon-reload && systemctl enable --now email-celery.service && systemctl status --no-pager -l email-celery.service'\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1091,8 +1043,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!ssh kultmost 'systemctl restart email-celery.service'"
|
"!ssh kultmost 'systemctl restart email-celery.service'"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1106,8 +1057,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!ssh kultmost 'systemctl status email-celery.service'"
|
"!ssh kultmost 'systemctl status email-celery.service'"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -1129,8 +1079,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"# !scp kultmost:/etc/nginx/sites-enabled/default nginx_conf "
|
"# !scp kultmost:/etc/nginx/sites-enabled/default nginx_conf "
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1146,8 +1095,7 @@
|
|||||||
"!scp nginx_conf kultmost:/tmp/default\n",
|
"!scp nginx_conf kultmost:/tmp/default\n",
|
||||||
"!ssh kultmost 'sudo mv /tmp/default /etc/nginx/sites-enabled/default'\n",
|
"!ssh kultmost 'sudo mv /tmp/default /etc/nginx/sites-enabled/default'\n",
|
||||||
"!ssh kultmost 'nginx -t'"
|
"!ssh kultmost 'nginx -t'"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1161,8 +1109,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!ssh kultmost 'nginx -s reload'"
|
"!ssh kultmost 'nginx -s reload'"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -1187,8 +1134,7 @@
|
|||||||
"sudo usermod -a -G microk8s $USER\n",
|
"sudo usermod -a -G microk8s $USER\n",
|
||||||
"newgrp microk8s\n",
|
"newgrp microk8s\n",
|
||||||
"microk8s status"
|
"microk8s status"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1204,8 +1150,7 @@
|
|||||||
"curl -LO https://cert-manager.io/public-keys/cert-manager-keyring-2021-09-20-1020CF3C033D4F35BAE1C19E1226061C665DF13E.gpg\n",
|
"curl -LO https://cert-manager.io/public-keys/cert-manager-keyring-2021-09-20-1020CF3C033D4F35BAE1C19E1226061C665DF13E.gpg\n",
|
||||||
"helm install cert-manager oci://quay.io/jetstack/charts/cert-manager --version v1.20.2 --namespace cert-manager --create-namespace --verify --keyring ./cert-manager-keyring-2021-09-20-1020CF3C033D4F35BAE1C19E1226061C665DF13E.gpg --set crds.enabled=true\n",
|
"helm install cert-manager oci://quay.io/jetstack/charts/cert-manager --version v1.20.2 --namespace cert-manager --create-namespace --verify --keyring ./cert-manager-keyring-2021-09-20-1020CF3C033D4F35BAE1C19E1226061C665DF13E.gpg --set crds.enabled=true\n",
|
||||||
"microk8s helm install cert-manager oci://quay.io/jetstack/charts/cert-manager --version v1.20.2 --namespace cert-manager --create-namespace --verify --keyring ./cert-manager-keyring-2021-09-20-1020CF3C033D4F35BAE1C19E1226061C665DF13E.gpg --set crds.enabled=true"
|
"microk8s helm install cert-manager oci://quay.io/jetstack/charts/cert-manager --version v1.20.2 --namespace cert-manager --create-namespace --verify --keyring ./cert-manager-keyring-2021-09-20-1020CF3C033D4F35BAE1C19E1226061C665DF13E.gpg --set crds.enabled=true"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -1426,13 +1371,12 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"sss = await element_create(pc, tablet, mob)\n",
|
"sss = await element_create(pc, tablet, mob)\n",
|
||||||
"sss.innerHTML"
|
"sss.innerHTML"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": ".venv (3.14.6.final.0)",
|
"display_name": ".venv",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
@ -1446,7 +1390,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.14.6"
|
"version": "3.13.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|||||||
@ -257,7 +257,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.14.6"
|
"version": "3.13.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|||||||
489
main.ipynb
489
main.ipynb
File diff suppressed because it is too large
Load Diff
@ -38,8 +38,7 @@
|
|||||||
" load_env('env')\n",
|
" load_env('env')\n",
|
||||||
"except:\n",
|
"except:\n",
|
||||||
" load_env('env_example')"
|
" load_env('env_example')"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -49,8 +48,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"from db import *"
|
"from db import *"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -60,13 +58,12 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"await posts_collection.update_many({'status':'publish'},{'$set':{'status':'В каталоге'}})"
|
"await posts_collection.update_many({'status':'publish'},{'$set':{'status':'В каталоге'}})"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": ".venv (3.14.6.final.0)",
|
"display_name": ".venv",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
@ -80,7 +77,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.14.6"
|
"version": "3.13.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|||||||
58
tasks.ipynb
58
tasks.ipynb
@ -38,8 +38,7 @@
|
|||||||
" load_env('env')\n",
|
" load_env('env')\n",
|
||||||
"except:\n",
|
"except:\n",
|
||||||
" load_env('env_example')"
|
" load_env('env_example')"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -58,8 +57,7 @@
|
|||||||
"from models import NotifyItem\n",
|
"from models import NotifyItem\n",
|
||||||
"from auth import token_create\n",
|
"from auth import token_create\n",
|
||||||
"import asyncio\n"
|
"import asyncio\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -90,8 +88,7 @@
|
|||||||
" },\n",
|
" },\n",
|
||||||
" upsert=True,\n",
|
" upsert=True,\n",
|
||||||
" )\n"
|
" )\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -120,8 +117,7 @@
|
|||||||
" 'login_link': login_link,\n",
|
" 'login_link': login_link,\n",
|
||||||
" },\n",
|
" },\n",
|
||||||
" 'Новая картина', 'main.html')\n"
|
" 'Новая картина', 'main.html')\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -132,8 +128,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"async def update_social_post(post):\n",
|
"async def update_social_post(post):\n",
|
||||||
" pass"
|
" pass"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -172,8 +167,7 @@
|
|||||||
" attachments = [a for a in get_attachments(social) if a is not None]\n",
|
" attachments = [a for a in get_attachments(social) if a is not None]\n",
|
||||||
" \n",
|
" \n",
|
||||||
" client.notify.delay(post_ref, text, attachments, bson_clear(social), sign_avatar)"
|
" client.notify.delay(post_ref, text, attachments, bson_clear(social), sign_avatar)"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -189,8 +183,7 @@
|
|||||||
" pass\n",
|
" pass\n",
|
||||||
" else:\n",
|
" else:\n",
|
||||||
" print(competition)"
|
" print(competition)"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -418,8 +411,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"# async def service_social_news(news: Dict, **kwargs):\n",
|
"# async def service_social_news(news: Dict, **kwargs):\n",
|
||||||
"# return await service_social_publish(\"news\", news, **kwargs)"
|
"# return await service_social_publish(\"news\", news, **kwargs)"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -467,8 +459,7 @@
|
|||||||
" if already_sent:\n",
|
" if already_sent:\n",
|
||||||
" print(social)\n",
|
" print(social)\n",
|
||||||
" client.notify.delay(post_ref, text, attachments, bson_clear(social), False)"
|
" client.notify.delay(post_ref, text, attachments, bson_clear(social), False)"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -521,8 +512,7 @@
|
|||||||
" if already_sent:\n",
|
" if already_sent:\n",
|
||||||
" print(social)\n",
|
" print(social)\n",
|
||||||
" client.notify.delay(post_ref, text, attachments, bson_clear(social), False)"
|
" client.notify.delay(post_ref, text, attachments, bson_clear(social), False)"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -548,8 +538,7 @@
|
|||||||
" 'login_link': login_link\n",
|
" 'login_link': login_link\n",
|
||||||
" },\n",
|
" },\n",
|
||||||
" 'Новый пользователь', 'main.html')"
|
" 'Новый пользователь', 'main.html')"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -595,8 +584,7 @@
|
|||||||
" if PROD:\n",
|
" if PROD:\n",
|
||||||
" email_task.notify.delay(user['email'], {'competition': bson_clear(doc), 'login_link': f'{FULL_DOMAIN}/login/{await token_create(str(user['_id']), url=f'/competition/{doc.get(\"id\") or doc.get(\"_id\")}')}'}, 'Конкурс', 'competition.html')\n",
|
" email_task.notify.delay(user['email'], {'competition': bson_clear(doc), 'login_link': f'{FULL_DOMAIN}/login/{await token_create(str(user['_id']), url=f'/competition/{doc.get(\"id\") or doc.get(\"_id\")}')}'}, 'Конкурс', 'competition.html')\n",
|
||||||
" await asyncio.gather(*new_notify)"
|
" await asyncio.gather(*new_notify)"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -618,8 +606,7 @@
|
|||||||
" },\n",
|
" },\n",
|
||||||
" 'Приглашение', 'main.html')\n",
|
" 'Приглашение', 'main.html')\n",
|
||||||
" await notify_in_profile(NotifyItem(user_id=user_id, type_item='invation', title='Приглашение', link='/profile/invitation', text=f'Вы прошли отбор на конкурсе {competition['title']}'))\n"
|
" await notify_in_profile(NotifyItem(user_id=user_id, type_item='invation', title='Приглашение', link='/profile/invitation', text=f'Вы прошли отбор на конкурсе {competition['title']}'))\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -640,8 +627,7 @@
|
|||||||
" delivery = await delivery_cursor.limit(1).to_list(length=1)\n",
|
" delivery = await delivery_cursor.limit(1).to_list(length=1)\n",
|
||||||
" delivery = delivery[0] if delivery else {}\n",
|
" delivery = delivery[0] if delivery else {}\n",
|
||||||
" return delivery.get('receiver')"
|
" return delivery.get('receiver')"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -686,8 +672,7 @@
|
|||||||
" link=f'/profile/delivery',\n",
|
" link=f'/profile/delivery',\n",
|
||||||
" text=f'Художник принял условия'\n",
|
" text=f'Художник принял условия'\n",
|
||||||
" ))"
|
" ))"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -789,8 +774,7 @@
|
|||||||
" 'main.html'\n",
|
" 'main.html'\n",
|
||||||
" )\n",
|
" )\n",
|
||||||
" \n"
|
" \n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -896,8 +880,7 @@
|
|||||||
" 'Обновление статуса заявки на конкурс',\n",
|
" 'Обновление статуса заявки на конкурс',\n",
|
||||||
" 'main.html'\n",
|
" 'main.html'\n",
|
||||||
" )"
|
" )"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -931,13 +914,12 @@
|
|||||||
" 'login_link': login_link\n",
|
" 'login_link': login_link\n",
|
||||||
" },\n",
|
" },\n",
|
||||||
" 'Новая заявка на конкурс', 'main.html')"
|
" 'Новая заявка на конкурс', 'main.html')"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": ".venv (3.14.6.final.0)",
|
"display_name": ".venv",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
@ -951,7 +933,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.14.6"
|
"version": "3.13.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|||||||
53
tg.ipynb
53
tg.ipynb
@ -48,8 +48,7 @@
|
|||||||
" load_env('env')\n",
|
" load_env('env')\n",
|
||||||
"except:\n",
|
"except:\n",
|
||||||
" load_env('env_example')\n"
|
" load_env('env_example')\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -82,8 +81,7 @@
|
|||||||
"import asyncio\n",
|
"import asyncio\n",
|
||||||
"import json\n",
|
"import json\n",
|
||||||
"from datetime import datetime, time, timedelta, timezone\n"
|
"from datetime import datetime, time, timedelta, timezone\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -95,8 +93,7 @@
|
|||||||
"Image.MAX_IMAGE_PIXELS = 50_000_000\n",
|
"Image.MAX_IMAGE_PIXELS = 50_000_000\n",
|
||||||
"TMP_DIR = Path(\"/tmp\")\n",
|
"TMP_DIR = Path(\"/tmp\")\n",
|
||||||
"TMP_DIR.mkdir(parents=True, exist_ok=True)"
|
"TMP_DIR.mkdir(parents=True, exist_ok=True)"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -106,8 +103,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"celery_app_tg = Celery('tg', broker=f'amqps://admin:{RABBITMQ_PASS}@{RABBITMQ_HOST}:{RABBITMQ_PORT}/tg', task_track_started=True )\n"
|
"celery_app_tg = Celery('tg', broker=f'amqps://admin:{RABBITMQ_PASS}@{RABBITMQ_HOST}:{RABBITMQ_PORT}/tg', task_track_started=True )\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -124,8 +120,7 @@
|
|||||||
" if chunk:\n",
|
" if chunk:\n",
|
||||||
" chunks.append(chunk)\n",
|
" chunks.append(chunk)\n",
|
||||||
" return b\"\".join(chunks)\n"
|
" return b\"\".join(chunks)\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -146,8 +141,7 @@
|
|||||||
" img = await fetch_bytes(client, f\"https://api.telegram.org/file/bot{BOT_TOKEN}/{file_path}\")\n",
|
" img = await fetch_bytes(client, f\"https://api.telegram.org/file/bot{BOT_TOKEN}/{file_path}\")\n",
|
||||||
" new_tg = (channel_name, BytesIO(img))\n",
|
" new_tg = (channel_name, BytesIO(img))\n",
|
||||||
" print(channel_name)\n"
|
" print(channel_name)\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -217,8 +211,7 @@
|
|||||||
" images.append(img)\n",
|
" images.append(img)\n",
|
||||||
"\n",
|
"\n",
|
||||||
" return images"
|
" return images"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -243,8 +236,7 @@
|
|||||||
" \"media\": f\"attach://file{i}\",\n",
|
" \"media\": f\"attach://file{i}\",\n",
|
||||||
" })\n",
|
" })\n",
|
||||||
" return media"
|
" return media"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -322,8 +314,7 @@
|
|||||||
" await asyncio.sleep(0.8 * attempt)\n",
|
" await asyncio.sleep(0.8 * attempt)\n",
|
||||||
"\n",
|
"\n",
|
||||||
" raise last_exc\n"
|
" raise last_exc\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -344,8 +335,7 @@
|
|||||||
" # The API returns JSON like {\"ok\":true,\"result\":true}\n",
|
" # The API returns JSON like {\"ok\":true,\"result\":true}\n",
|
||||||
" data = response.json()\n",
|
" data = response.json()\n",
|
||||||
" return data.get(\"ok\") and data.get(\"result\") is True"
|
" return data.get(\"ok\") and data.get(\"result\") is True"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -374,8 +364,7 @@
|
|||||||
" # httpx.post(f'{FULL_PATH_DOMAIN}/tg', json={'item': item, 'result': result}, headers={\"Authorization\": f\"bearer {ATOKEN}\"})\n",
|
" # httpx.post(f'{FULL_PATH_DOMAIN}/tg', json={'item': item, 'result': result}, headers={\"Authorization\": f\"bearer {ATOKEN}\"})\n",
|
||||||
" except Exception as exc:\n",
|
" except Exception as exc:\n",
|
||||||
" raise self.retry(exc=exc, countdown=30)\n"
|
" raise self.retry(exc=exc, countdown=30)\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -404,8 +393,7 @@
|
|||||||
" httpx.post(f'{FULL_PATH_DOMAIN}/tg', json={'item': item, 'result': result}, headers={\"Authorization\": f\"bearer {ATOKEN}\"})\n",
|
" httpx.post(f'{FULL_PATH_DOMAIN}/tg', json={'item': item, 'result': result}, headers={\"Authorization\": f\"bearer {ATOKEN}\"})\n",
|
||||||
" except Exception as exc:\n",
|
" except Exception as exc:\n",
|
||||||
" raise self.retry(exc=exc, countdown=30)\n"
|
" raise self.retry(exc=exc, countdown=30)\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -426,8 +414,7 @@
|
|||||||
" asyncio.run(new_channel_reg(chat_id))\n",
|
" asyncio.run(new_channel_reg(chat_id))\n",
|
||||||
" except Exception as exc:\n",
|
" except Exception as exc:\n",
|
||||||
" raise self.retry(exc=exc, countdown=30)\n"
|
" raise self.retry(exc=exc, countdown=30)\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -466,8 +453,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
" with open(f'{filename_without_extension}.py', 'w') as f:\n",
|
" with open(f'{filename_without_extension}.py', 'w') as f:\n",
|
||||||
" f.write('\\n\\n'.join(app))\n"
|
" f.write('\\n\\n'.join(app))\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -477,8 +463,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!celery -A tg.celery_app_tg worker --loglevel=info"
|
"!celery -A tg.celery_app_tg worker --loglevel=info"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -528,8 +513,7 @@
|
|||||||
" else:\n",
|
" else:\n",
|
||||||
" print(\"Failed to delete message.\")\n",
|
" print(\"Failed to delete message.\")\n",
|
||||||
"\n"
|
"\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -537,8 +521,7 @@
|
|||||||
"id": "416f454c",
|
"id": "416f454c",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [],
|
"source": []
|
||||||
"display_name": ".venv"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
@ -557,7 +540,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.14.6"
|
"version": "3.13.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|||||||
161
vk.ipynb
161
vk.ipynb
@ -53,8 +53,7 @@
|
|||||||
" load_env('env_example')\n",
|
" load_env('env_example')\n",
|
||||||
" except Exception:\n",
|
" except Exception:\n",
|
||||||
" pass"
|
" pass"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -86,8 +85,7 @@
|
|||||||
"from fastapi import APIRouter, Depends, Request, Response\n",
|
"from fastapi import APIRouter, Depends, Request, Response\n",
|
||||||
"from fastapi.responses import RedirectResponse\n",
|
"from fastapi.responses import RedirectResponse\n",
|
||||||
"from images import insert_logo\n"
|
"from images import insert_logo\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -105,8 +103,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"celery_app_vk = Celery('vk', broker=f'{redis_uri}1', backend=f'{redis_uri}1', task_track_started=True )\n"
|
"celery_app_vk = Celery('vk', broker=f'{redis_uri}1', backend=f'{redis_uri}1', task_track_started=True )\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -116,8 +113,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"token_manager = TokenManager()\n"
|
"token_manager = TokenManager()\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -158,8 +154,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
" # Привязка соцсети к уже залогиненному пользователю\n",
|
" # Привязка соцсети к уже залогиненному пользователю\n",
|
||||||
" return RedirectResponse(url='/profile/social', status_code=status.HTTP_303_SEE_OTHER)"
|
" return RedirectResponse(url='/profile/social', status_code=status.HTTP_303_SEE_OTHER)"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -189,8 +184,7 @@
|
|||||||
" images[_id] = (\"photo\", (name, background, \"image/jpeg\"))\n",
|
" images[_id] = (\"photo\", (name, background, \"image/jpeg\"))\n",
|
||||||
" \n",
|
" \n",
|
||||||
" return images\n"
|
" return images\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -263,8 +257,7 @@
|
|||||||
" await mongo_client[db_name][item.get('col')].update_one({'_id': ObjectId(item.get('_id'))}, update_spec)\n",
|
" await mongo_client[db_name][item.get('col')].update_one({'_id': ObjectId(item.get('_id'))}, update_spec)\n",
|
||||||
" return {\"ok\": True}\n",
|
" return {\"ok\": True}\n",
|
||||||
"\n"
|
"\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -340,8 +333,7 @@
|
|||||||
" await mongo_client[db_name][item.get('col')].update_one({'_id': ObjectId(item.get('_id'))}, update_spec)\n",
|
" await mongo_client[db_name][item.get('col')].update_one({'_id': ObjectId(item.get('_id'))}, update_spec)\n",
|
||||||
" return {\"ok\": True}\n",
|
" return {\"ok\": True}\n",
|
||||||
"\n"
|
"\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -394,8 +386,7 @@
|
|||||||
" )\n",
|
" )\n",
|
||||||
"\n",
|
"\n",
|
||||||
" return {\"ok\": True}\n"
|
" return {\"ok\": True}\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -430,8 +421,7 @@
|
|||||||
" \n",
|
" \n",
|
||||||
" except Exception as exc:\n",
|
" except Exception as exc:\n",
|
||||||
" raise self.retry(exc=exc)\n"
|
" raise self.retry(exc=exc)\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -466,8 +456,7 @@
|
|||||||
" \n",
|
" \n",
|
||||||
" except Exception as exc:\n",
|
" except Exception as exc:\n",
|
||||||
" raise self.retry(exc=exc)\n"
|
" raise self.retry(exc=exc)\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -502,8 +491,7 @@
|
|||||||
" \n",
|
" \n",
|
||||||
" except Exception as exc:\n",
|
" except Exception as exc:\n",
|
||||||
" raise self.retry(exc=exc)\n"
|
" raise self.retry(exc=exc)\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -534,8 +522,7 @@
|
|||||||
"# timeout=100\n",
|
"# timeout=100\n",
|
||||||
"# ).json()\n",
|
"# ).json()\n",
|
||||||
"# await asyncio.sleep(1)\n"
|
"# await asyncio.sleep(1)\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -566,8 +553,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
" with open(f'{filename_without_extension}.py', 'w') as f:\n",
|
" with open(f'{filename_without_extension}.py', 'w') as f:\n",
|
||||||
" f.write('\\n\\n'.join(app))\n"
|
" f.write('\\n\\n'.join(app))\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -581,8 +567,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!celery -A vk.celery_app_vk worker --loglevel=info"
|
"!celery -A vk.celery_app_vk worker --loglevel=info"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -596,8 +581,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!docker build -t registry.spiritofweb.ru/avtopost-api:latest ."
|
"!docker build -t registry.spiritofweb.ru/avtopost-api:latest ."
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -611,8 +595,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!sudo docker image push registry.spiritofweb.ru/avtopost-api:latest"
|
"!sudo docker image push registry.spiritofweb.ru/avtopost-api:latest"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -626,8 +609,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!kubectl rollout restart deployments/vk-celery -n kultmost"
|
"!kubectl rollout restart deployments/vk-celery -n kultmost"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -641,8 +623,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!echo $REGISTRY_HOST"
|
"!echo $REGISTRY_HOST"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -660,8 +641,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"stop"
|
"stop"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -671,8 +651,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"user_id = '681684390000000000000000'"
|
"user_id = '681684390000000000000000'"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -683,8 +662,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"await redis_client.delete(f\"access_token:{user_id}\")\n",
|
"await redis_client.delete(f\"access_token:{user_id}\")\n",
|
||||||
"await redis_client.delete(f\"tokens:{user_id}\")"
|
"await redis_client.delete(f\"tokens:{user_id}\")"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -708,8 +686,7 @@
|
|||||||
" },\n",
|
" },\n",
|
||||||
" upsert=True,\n",
|
" upsert=True,\n",
|
||||||
")\n"
|
")\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -719,8 +696,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"import token_manager as tm"
|
"import token_manager as tm"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -731,8 +707,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"from token_manager import TokenManager\n",
|
"from token_manager import TokenManager\n",
|
||||||
"token_manager = TokenManager()"
|
"token_manager = TokenManager()"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -744,8 +719,7 @@
|
|||||||
"token_manager = TokenManager()\n",
|
"token_manager = TokenManager()\n",
|
||||||
"access_token = await token_manager.get_access_token('644fa8bb0000000000000000')\n",
|
"access_token = await token_manager.get_access_token('644fa8bb0000000000000000')\n",
|
||||||
"access_token"
|
"access_token"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -756,8 +730,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"item ={'_id': '6a21559cca3ad8a73b652bcb', 'db': 'competitions', 'col': 'competitions'} \n",
|
"item ={'_id': '6a21559cca3ad8a73b652bcb', 'db': 'competitions', 'col': 'competitions'} \n",
|
||||||
"file_ids = ['681684390000000000000000', '6a21559cca3ad8a73b652bc6']"
|
"file_ids = ['681684390000000000000000', '6a21559cca3ad8a73b652bc6']"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -768,8 +741,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"docs =[ doc async for doc in mongo_client['social']['social'].find({'user_id':'681684390000000000000000'})]\n",
|
"docs =[ doc async for doc in mongo_client['social']['social'].find({'user_id':'681684390000000000000000'})]\n",
|
||||||
"doc = docs[1]"
|
"doc = docs[1]"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -779,8 +751,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"competition = await competitions_col.find_one({'_id':ObjectId('6a21559cca3ad8a73b652bcb')})"
|
"competition = await competitions_col.find_one({'_id':ObjectId('6a21559cca3ad8a73b652bcb')})"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -790,8 +761,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"images = await get_images(db_name, file_ids, sign_avatar)"
|
"images = await get_images(db_name, file_ids, sign_avatar)"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -833,8 +803,7 @@
|
|||||||
" })\n",
|
" })\n",
|
||||||
" res = resp.json()\n",
|
" res = resp.json()\n",
|
||||||
" res.update({'doc': doc})"
|
" res.update({'doc': doc})"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -844,8 +813,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"res"
|
"res"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -912,8 +880,7 @@
|
|||||||
" update_spec = {\"$push\": {\"vk\": res}}\n",
|
" update_spec = {\"$push\": {\"vk\": res}}\n",
|
||||||
" await mongo_client[db_name][item.get('col')].update_one({'_id': ObjectId(item.get('_id'))}, update_spec)\n",
|
" await mongo_client[db_name][item.get('col')].update_one({'_id': ObjectId(item.get('_id'))}, update_spec)\n",
|
||||||
" return {\"ok\": True}\n"
|
" return {\"ok\": True}\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -952,8 +919,7 @@
|
|||||||
" })\n",
|
" })\n",
|
||||||
" print(resp_wall.json())\n",
|
" print(resp_wall.json())\n",
|
||||||
" \n"
|
" \n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -963,8 +929,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"await competitions_col.find_one({'_id': competition['_id']})"
|
"await competitions_col.find_one({'_id': competition['_id']})"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -979,8 +944,7 @@
|
|||||||
" \"$push\": {\"vk\": resp_wall.json()}\n",
|
" \"$push\": {\"vk\": resp_wall.json()}\n",
|
||||||
" },\n",
|
" },\n",
|
||||||
" )"
|
" )"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -995,8 +959,7 @@
|
|||||||
" \"v\": \"5.199\",\n",
|
" \"v\": \"5.199\",\n",
|
||||||
" })\n",
|
" })\n",
|
||||||
"resp.json()['response'][0]"
|
"resp.json()['response'][0]"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1006,8 +969,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"[doc async for doc in mongo_client['social']['social'].find({'user_id':competition['user']['id']})]"
|
"[doc async for doc in mongo_client['social']['social'].find({'user_id':competition['user']['id']})]"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1025,8 +987,7 @@
|
|||||||
"})\n",
|
"})\n",
|
||||||
"\n",
|
"\n",
|
||||||
"z.json()['response']"
|
"z.json()['response']"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1036,8 +997,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"#!pip freeze > requirements.txt"
|
"#!pip freeze > requirements.txt"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1057,8 +1017,7 @@
|
|||||||
" \"body\": \"group_id=191599084&user_id=392892935&role=moderator&is_contact=0&contact_position=&contact_phone=&contact_email=&permissions=&access_token=vk1.a.-kG07OUZgX5FrxtsQrU5QJh8HaP_suYXkqcg\",\n",
|
" \"body\": \"group_id=191599084&user_id=392892935&role=moderator&is_contact=0&contact_position=&contact_phone=&contact_email=&permissions=&access_token=vk1.a.-kG07OUZgX5FrxtsQrU5QJh8HaP_suYXkqcg\",\n",
|
||||||
" \"method\": \"POST\",\n",
|
" \"method\": \"POST\",\n",
|
||||||
"});"
|
"});"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1076,8 +1035,7 @@
|
|||||||
"VK_CLIENT_ID = 51852444\n",
|
"VK_CLIENT_ID = 51852444\n",
|
||||||
"SCOPES = 'offline,wall,photos,groups'\n",
|
"SCOPES = 'offline,wall,photos,groups'\n",
|
||||||
"redirect_uri = 'https://oauth.vk.ru/blank.html'"
|
"redirect_uri = 'https://oauth.vk.ru/blank.html'"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1108,8 +1066,7 @@
|
|||||||
"url = f'{AUTHORIZE_URL}?responsetype_item=code&client_id={VK_CLIENT_ID}&scope={SCOPES}&redirect_uri={redirect_uri}&state={state}&code_challenge={code_challenge}&code_challenge_method=S256'\n",
|
"url = f'{AUTHORIZE_URL}?responsetype_item=code&client_id={VK_CLIENT_ID}&scope={SCOPES}&redirect_uri={redirect_uri}&state={state}&code_challenge={code_challenge}&code_challenge_method=S256'\n",
|
||||||
"\n",
|
"\n",
|
||||||
"print(f\"\\n\\n{url}\\n\\n\")"
|
"print(f\"\\n\\n{url}\\n\\n\")"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1121,8 +1078,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"code='vk2.a.---'\n",
|
"code='vk2.a.---'\n",
|
||||||
"device_id=''"
|
"device_id=''"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1133,8 +1089,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"refresh_token = \"vk2.a.-----\"\n",
|
"refresh_token = \"vk2.a.-----\"\n",
|
||||||
"device_id = \"-\"\n"
|
"device_id = \"-\"\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1153,8 +1108,7 @@
|
|||||||
" 'state': os.urandom(32).hex(),\n",
|
" 'state': os.urandom(32).hex(),\n",
|
||||||
"})\n",
|
"})\n",
|
||||||
"z.json()"
|
"z.json()"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1165,8 +1119,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"CLIENT_ID = 51852444\n",
|
"CLIENT_ID = 51852444\n",
|
||||||
"OAUTH_URL = 'https://id.vk.com/oauth2/auth'"
|
"OAUTH_URL = 'https://id.vk.com/oauth2/auth'"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1187,8 +1140,7 @@
|
|||||||
" 'redirect_uri': 'https://oauth.vk.com/blank.html'\n",
|
" 'redirect_uri': 'https://oauth.vk.com/blank.html'\n",
|
||||||
"})\n",
|
"})\n",
|
||||||
"r.json()\n"
|
"r.json()\n"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1209,8 +1161,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"z=T()\n",
|
"z=T()\n",
|
||||||
"z.json()"
|
"z.json()"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1221,8 +1172,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"refresh_token=r.json()['refresh_token']\n",
|
"refresh_token=r.json()['refresh_token']\n",
|
||||||
"refresh_token"
|
"refresh_token"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1241,8 +1191,7 @@
|
|||||||
" 'state': os.urandom(32).hex(),\n",
|
" 'state': os.urandom(32).hex(),\n",
|
||||||
"})\n",
|
"})\n",
|
||||||
"z.json()"
|
"z.json()"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1252,8 +1201,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"print(f'\\n\\n{z.json()['refresh_token']}\\n\\n')"
|
"print(f'\\n\\n{z.json()['refresh_token']}\\n\\n')"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
@ -1263,8 +1211,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"users.search"
|
"users.search"
|
||||||
],
|
]
|
||||||
"display_name": ".venv"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
@ -1650,7 +1597,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.14.6"
|
"version": "3.13.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user