{"id":478149,"date":"2026-04-30T15:52:57","date_gmt":"2026-04-30T15:52:57","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=478149"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=478149","title":{"rendered":"\u0425\u043e\u0441\u0442\u0438\u043d\u0433 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432 Google Colab \u0431\u0435\u0437 ngrok \u0438 cloudflared"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h3>\u0417\u0430\u0447\u0435\u043c \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e<\/h3>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443, \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u043c\u0443 \u0432 Colab, \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0442\u0443\u043d\u043d\u0435\u043b\u0438. \u041d\u043e \u0443 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b:<\/p>\n<p><strong>ngrok<\/strong> \u2014 TCP-\u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u044b \u0442\u0435\u043f\u0435\u0440\u044c \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u0431\u0430\u043d\u043a\u043e\u0432\u0441\u043a\u043e\u0439 \u043a\u0430\u0440\u0442\u044b. \u0424\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e, \u043d\u043e \u043a\u0430\u0440\u0442\u0443 \u0434\u0430\u0432\u0430\u0439.<\/p>\n<p><strong>cloudflared<\/strong> \u2014 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u044b \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 Colab, \u043f\u043b\u044e\u0441 \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0441\u0443\u0431\u0434\u043e\u043c\u0435\u043d.<\/p>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 Colab \u0435\u0441\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0434\u043b\u044f \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0440\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442.<\/p>\n<hr\/>\n<h3>\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 proxyPort<\/h3>\n<p>Colab \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>google.colab.output.eval_js<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 URL \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430:<\/p>\n<pre><code class=\"python\">from google.colab.output import eval_jsurl = eval_js(\"google.colab.kernel.proxyPort(8000)\")print(url)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:87px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u2014 URL \u0432\u0438\u0434\u0430 <a href=\"https:\/\/%7Bport%7D-%7Binstance-id%7D.%7Bregion%7D.prod.colab.dev\" rel=\"noopener noreferrer nofollow\"><code>https:\/\/{port}-{instance-id}.{region}.prod.colab.dev<\/code><\/a>. \u042d\u0442\u043e \u043d\u0435 \u0442\u0443\u043d\u043d\u0435\u043b\u044c, \u0430 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u043a\u0441\u0438 \u0441\u0430\u043c\u043e\u0433\u043e Colab.<\/p>\n<hr\/>\n<h3>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430: \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u0430\u043a \u043d\u0435 \u0434\u043e\u0441\u0442\u0443\u0447\u0430\u0442\u044c\u0441\u044f<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 URL \u0447\u0435\u0440\u0435\u0437 <code>requests<\/code> \u2014 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u044b\u0439\u0434\u0435\u0442. Colab \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u043e\u0440\u0442\u0443 \u0447\u0435\u0440\u0435\u0437 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u0443\u043a\u0438.<\/p>\n<p>\u041d\u0443\u0436\u043d\u044b\u0439 \u043a\u0443\u043a\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>colab-runtime-proxy-token<\/code> . \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u043e\u0439 \u0441\u0435\u0441\u0441\u0438\u0438 \u0441 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c Colab:<\/p>\n<ol>\n<li>\n<p>\u041e\u0442\u043a\u0440\u044b\u0442\u044c URL \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043a\u0440\u044b\u0442\u044c DevTools \u2192 Application \u2192 Cookies<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0439\u0442\u0438 <code>colab-runtime-proxy-token<\/code><\/p>\n<\/li>\n<\/ol>\n<hr\/>\n<h3>\u0420\u0435\u0448\u0435\u043d\u0438\u0435: \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u0442\u043e\u043a\u0435\u043d \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445<\/h3>\n<p>\u0418\u043c\u0435\u044f \u0442\u043e\u043a\u0435\u043d, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e \u0438\u0437 \u043b\u044e\u0431\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430:<\/p>\n<pre><code class=\"python\">import requestsurl = \"https:\/\/{port}-{instance-id}.{region}.prod.colab.dev\/endpoint\"cookies = {\"colab-runtime-proxy-token\": \"\u0412\u0410\u0428_\u0422\u041e\u041a\u0415\u041d\"}response = requests.get(url, cookies=cookies)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<hr\/>\n<h3>\u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440<\/h3>\n<p><strong>\u0412 Colab \u2014 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440:<\/strong><\/p>\n<pre><code class=\"python\">from fastapi import FastAPIimport uvicornfrom google.colab.output import eval_jsimport threadingapp = FastAPI()@app.get(\"\/ping\")def ping():    return {\"status\": \"ok\"}url = eval_js(\"google.colab.kernel.proxyPort(8000)\")print(f\"URL: {url}\")threading.Thread(target=lambda: uvicorn.run(app, host=\"0.0.0.0\", port=8000)).start()<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0418\u043b\u0438<\/p>\n<pre><code class=\"python\">url = eval_js(\"google.colab.kernel.proxyPort(8000)\")print(f\"URL: {url}\")from fastapi import FastAPIimport uvicornfrom google.colab.output import eval_jsimport threadingapp = FastAPI()@app.get(\"\/ping\")def ping():    return {\"status\": \"ok\"}uvicorn.run(app, host=\"0.0.0.0\", port=8000)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>\u0421\u043d\u0430\u0440\u0443\u0436\u0438 \u2014 \u0434\u0435\u043b\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441:<\/strong><\/p>\n<pre><code class=\"python\">import requestsurl = \"https:\/\/{port}-{instance-id}.{region}.prod.colab.dev\/ping\"cookies = {\"colab-runtime-proxy-token\": \"\u0412\u0410\u0428_\u0422\u041e\u041a\u0415\u041d\"}print(requests.get(url, cookies=cookies).json())# {'status': 'ok'}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<hr\/>\n<h3>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f<\/h3>\n<ul>\n<li>\n<p>\u0421\u0435\u0440\u0432\u0435\u0440 \u0436\u0438\u0432\u0451\u0442 \u043f\u043e\u043a\u0430 Colab \u043d\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442 runtime (\u0434\u043e 12 \u0447\u0430\u0441\u043e\u0432 \u043d\u0430 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u043c \u043f\u043b\u0430\u043d\u0435)<\/p>\n<\/li>\n<li>\n<p>URL \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0430<\/p>\n<\/li>\n<\/ul>\n<\/div>\n<p>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/1030228\/\">https:\/\/habr.com\/ru\/articles\/1030228\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0417\u0430\u0447\u0435\u043c \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e\u041a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443, \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u043c\u0443 \u0432 Colab, \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0442\u0443\u043d\u043d\u0435\u043b\u0438. \u041d\u043e \u0443 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b:ngrok \u2014 TCP-\u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u044b \u0442\u0435\u043f\u0435\u0440\u044c \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u0431\u0430\u043d\u043a\u043e\u0432\u0441\u043a\u043e\u0439 \u043a\u0430\u0440\u0442\u044b. \u0424\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e, \u043d\u043e \u043a\u0430\u0440\u0442\u0443 \u0434\u0430\u0432\u0430\u0439.cloudflared \u2014 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u044b \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 Colab, \u043f\u043b\u044e\u0441 \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0441\u0443\u0431\u0434\u043e\u043c\u0435\u043d.\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 Colab \u0435\u0441\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0434\u043b\u044f \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0440\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442.\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 proxyPortColab \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e google.colab.output.eval_js, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 URL \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430:from google.colab.output import eval_jsurl = eval_js(&#171;google.colab.kernel.proxyPort(8000)&#187;)print(url)\u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u2014 URL \u0432\u0438\u0434\u0430 https:\/\/{port}-{instance-id}.{region}.prod.colab.dev. \u042d\u0442\u043e \u043d\u0435 \u0442\u0443\u043d\u043d\u0435\u043b\u044c, \u0430 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u043a\u0441\u0438 \u0441\u0430\u043c\u043e\u0433\u043e Colab.\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430: \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u0430\u043a \u043d\u0435 \u0434\u043e\u0441\u0442\u0443\u0447\u0430\u0442\u044c\u0441\u044f\u0415\u0441\u043b\u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 URL \u0447\u0435\u0440\u0435\u0437 requests \u2014 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u044b\u0439\u0434\u0435\u0442. Colab \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u043e\u0440\u0442\u0443 \u0447\u0435\u0440\u0435\u0437 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u0443\u043a\u0438.\u041d\u0443\u0436\u043d\u044b\u0439 \u043a\u0443\u043a\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f colab-runtime-proxy-token . \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u043e\u0439 \u0441\u0435\u0441\u0441\u0438\u0438 \u0441 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c Colab:\u041e\u0442\u043a\u0440\u044b\u0442\u044c URL \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435\u041e\u0442\u043a\u0440\u044b\u0442\u044c DevTools \u2192 Application \u2192 Cookies\u041d\u0430\u0439\u0442\u0438 colab-runtime-proxy-token\u0420\u0435\u0448\u0435\u043d\u0438\u0435: \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u0442\u043e\u043a\u0435\u043d \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445\u0418\u043c\u0435\u044f \u0442\u043e\u043a\u0435\u043d, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e \u0438\u0437 \u043b\u044e\u0431\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430:import requestsurl = &#171;https:\/\/{port}-{instance-id}.{region}.prod.colab.dev\/endpoint&#187;cookies = {&#171;colab-runtime-proxy-token&#187;: &#171;\u0412\u0410\u0428_\u0422\u041e\u041a\u0415\u041d&#187;}response = requests.get(url, cookies=cookies)\u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440\u0412 Colab \u2014 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440:from fastapi import FastAPIimport uvicornfrom google.colab.output import eval_jsimport threadingapp = FastAPI()@app.get(&#171;\/ping&#187;)def ping():    return {&#171;status&#187;: &#171;ok&#187;}url = eval_js(&#171;google.colab.kernel.proxyPort(8000)&#187;)print(f&#187;URL: {url}&#187;)threading.Thread(target=lambda: uvicorn.run(app, host=&#187;0.0.0.0&#8243;, port=8000)).start()\u0418\u043b\u0438url = eval_js(&#171;google.colab.kernel.proxyPort(8000)&#187;)print(f&#187;URL: {url}&#187;)from fastapi import FastAPIimport uvicornfrom google.colab.output import eval_jsimport threadingapp = FastAPI()@app.get(&#171;\/ping&#187;)def ping():    return {&#171;status&#187;: &#171;ok&#187;}uvicorn.run(app, host=&#187;0.0.0.0&#8243;, port=8000)\u0421\u043d\u0430\u0440\u0443\u0436\u0438 \u2014 \u0434\u0435\u043b\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441:import requestsurl = &#171;https:\/\/{port}-{instance-id}.{region}.prod.colab.dev\/ping&#187;cookies = {&#171;colab-runtime-proxy-token&#187;: &#171;\u0412\u0410\u0428_\u0422\u041e\u041a\u0415\u041d&#187;}print(requests.get(url, cookies=cookies).json())# {&#8216;status&#8217;: &#8216;ok&#8217;}\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u0421\u0435\u0440\u0432\u0435\u0440 \u0436\u0438\u0432\u0451\u0442 \u043f\u043e\u043a\u0430 Colab \u043d\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442 runtime (\u0434\u043e 12 \u0447\u0430\u0441\u043e\u0432 \u043d\u0430 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u043c \u043f\u043b\u0430\u043d\u0435)URL \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0430\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 https:\/\/habr.com\/ru\/articles\/1030228\/<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-478149","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/478149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=478149"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/478149\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=478149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=478149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=478149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}