{"id":54029,"date":"2024-02-01T02:26:53","date_gmt":"2024-01-31T17:26:53","guid":{"rendered":"https:\/\/kinqsta.com\/jp\/?p=54029&#038;preview=true&#038;preview_id=54029"},"modified":"2024-02-02T17:51:31","modified_gmt":"2024-02-02T08:51:31","slug":"url-shortener-with-python","status":"publish","type":"post","link":"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/","title":{"rendered":"Python\u3067\u30b7\u30f3\u30d7\u30eb\u306aURL\u77ed\u7e2e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>\u30e6\u30cb\u30d5\u30a9\u30fc\u30e0\u30fb\u30ea\u30bd\u30fc\u30b9\u30fb\u30ed\u30b1\u30fc\u30bf\uff08\u4e00\u822c\u7684\u306b\u306f<a href=\"https:\/\/kinqsta.com\/jp\/blog\/what-is-a-url\/\">URL<\/a>\u3068\u547c\u3070\u308c\u308b\u3082\u306e\uff09\u306f\u3001\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u4e0a\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u5b58\u5728\u5834\u6240\u3092\u793a\u3059\u30a2\u30c9\u30ec\u30b9\u3067\u3059\u3002URL\u306b\u306f\u3001\u30a6\u30a7\u30d6\u30da\u30fc\u30b8\u306e\u30a2\u30c9\u30ec\u30b9\u306e\u5f8c\u306b\u3001\u4e00\u898b\u30e9\u30f3\u30c0\u30e0\u306a\u6587\u5b57\u304c\u9577\u304f\u7d9a\u304f\u3053\u3068\u304c\u591a\u3005\u3042\u308a\u307e\u3059\u3002\u898b\u305f\u76ee\u304c\u7f8e\u3057\u304f\u306a\u304f\u3001\u899a\u3048\u3065\u3089\u3044\u3082\u306e\u3067\u3059\u3002\u3053\u308c\u3092\u6574\u3048\u308b\u306b\u306f\u3001URL\u77ed\u7e2e\u30c4\u30fc\u30eb\u304c\u4f7f\u3048\u307e\u3059\u3002<\/p>\n<p>URL\u3092\u77ed\u7e2e\u3059\u308b\u3068\u3001\u30a2\u30c9\u30ec\u30b9\u306e\u5171\u6709\u304c\u3057\u3084\u3059\u304f\u306a\u308a\u3001\u30e6\u30fc\u30b6\u30fc\u306b\u3088\u308b\u4e0d\u6b63\u78ba\u306a\u60c5\u5831\u306e\u5165\u529b\u306e\u53ef\u80fd\u6027\u3092\u4e0b\u3052\u308b\u306a\u3069\u3001\u3044\u304f\u3064\u3082\u306e\u30e1\u30ea\u30c3\u30c8\u304c\u3042\u308a\u307e\u3059\u3002URL\u306b1\u6587\u5b57\u3067\u3082\u6b20\u3051\u3066\u3044\u308b\u3068\u3001\u9593\u9055\u3063\u305f\u30da\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u3066\u3057\u307e\u3063\u305f\u308a\u3001\u305d\u3082\u305d\u3082\u30da\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u306a\u304b\u3063\u305f\u308a\u3057\u3066\u3001\u307e\u3063\u305f\u304f\u4f7f\u3044\u7269\u306b\u306a\u3089\u306a\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001<code>https:\/\/example.com\/blog-url-shorteners\/48bfefiahl9adik<\/code>\u3092<code>https:\/\/example.com\/url-shorteners<\/code>\u3068\u77ed\u7e2e\u3057\u305f\u4f8b\u3092\u8003\u3048\u3066\u307f\u307e\u3057\u3087\u3046\u3002\u3069\u3061\u3089\u3092\u5171\u6709\u3057\u3084\u3059\u3044\u304b\u3001\u3042\u308b\u3044\u306f\u3069\u3061\u3089\u306e\u65b9\u304c\u30bf\u30a4\u30d4\u30f3\u30b0\u4e2d\u306e\u30df\u30b9\u306b\u3064\u306a\u304c\u308a\u3084\u3059\u3044\u304b\u306f\u3001\u60f3\u50cf\u306b\u96e3\u304f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>URL\u77ed\u7e2e\u6a5f\u80fd\u306e\u5f37\u307f\u306f\u3001\u9577\u3044URL\u3092\u6574\u7406\u3059\u308b\u3060\u3051\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002URL\u77ed\u7e2e\u6a5f\u80fd\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u3042\u3089\u3086\u308b\u3053\u3068\u306b\u6d3b\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<ul>\n<li><strong>\u691c\u7d22\u30a8\u30f3\u30b8\u30f3\u3067\u306e\u30e9\u30f3\u30ad\u30f3\u30b0\u5411\u4e0a<\/strong>\uff1a\u30b3\u30f3\u30c6\u30f3\u30c4\u5236\u4f5c\u8005\u3001\u4f01\u696d\u3001\u30b9\u30bf\u30fc\u30c8\u30a2\u30c3\u30d7\u4f01\u696d\u306e\u591a\u304f\u304c\u3001\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u3001\u30d6\u30ed\u30b0\u3001SNS\u3067\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u516c\u958b\u3057\u3066\u3044\u307e\u3059\u3002<a href=\"https:\/\/kinqsta.com\/jp\/search-engine-market-share\/\">\u691c\u7d22\u30a8\u30f3\u30b8\u30f3<\/a>\u306f\u7279\u5b9a\u306e\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u542b\u3080\u30ea\u30f3\u30af\u3092\u597d\u3080\u50be\u5411\u304c\u3042\u308a\u3001\u305d\u308c\u306b\u5fdc\u3058\u3066\u30e9\u30f3\u30af\u4ed8\u3051\u304c\u591a\u5c11\u5909\u52d5\u3059\u308b\u3053\u3068\u3082\u3042\u308a\u307e\u3059\u3002\u65e2\u77e5\u306e\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u304b\u3089\u751f\u6210\u3055\u308c\u305f\u77ed\u3044URL\u306f\u3001\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u4e0a\u4f4d\u8868\u793a\u3092\u52a9\u3051\u308b\u8981\u7d20\u306b\u306a\u308a\u5f97\u307e\u3059\u3002<\/li>\n<li><strong>\u30ea\u30f3\u30af\u306e\u30c8\u30e9\u30d5\u30a3\u30c3\u30af\u306e\u8ffd\u8de1<\/strong>\uff1a<a href=\"https:\/\/bitly.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Bitly<\/a>\u306e\u3088\u3046\u306a\u6709\u6599URL\u77ed\u7e2e\u30b5\u30fc\u30d3\u30b9\u3092\u4f7f\u3048\u3070\u3001\u30ea\u30f3\u30af\u3092\u30af\u30ea\u30c3\u30af\u3057\u305f\u30e6\u30fc\u30b6\u30fc\u3092\u8ffd\u8de1\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u6d41\u5165\u30c8\u30e9\u30d5\u30a3\u30c3\u30af\u306e\u5206\u6790\u3084\u3001\u305d\u308c\u306b\u5fdc\u3058\u305f\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u8abf\u6574\u306b\u6709\u7528\u3067\u3059\u3002<\/li>\n<\/ul>\n<div><\/div><kinsta-auto-toc heading=\"Table of Contents\" exclude=\"last\" list-style=\"arrow\" selector=\"h2\" count-number=\"-1\"><\/kinsta-auto-toc>\n<h2>URL\u77ed\u7e2e\u306e2\u3064\u306e\u65b9\u6cd5\u2500Python\u30e9\u30a4\u30d6\u30e9\u30ea\u3068API<\/h2>\n<p>\u4eca\u56de\u306e\u8a18\u4e8b\u3067\u306f\u3001\u4ee5\u4e0b\u306e2\u3064\u306e\u65b9\u6cd5\u3067<a href=\"https:\/\/kinqsta.com\/jp\/topics\/python\/\">Python<\/a>\u3092\u4f7f\u3063\u305fURL\u77ed\u7e2e\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u306e\u69cb\u7bc9\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<ul>\n<li><a href=\"https:\/\/pyshorteners.readthedocs.io\/en\/latest\/\" target=\"_blank\" rel=\"noopener noreferrer\">pyshorteners<\/a>\u30e9\u30a4\u30d6\u30e9\u30ea<\/li>\n<li><a href=\"https:\/\/dev.bitly.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Bitly API<\/a><\/li>\n<\/ul>\n<p><strong>pyshorteners<\/strong>\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u958b\u767a\u306b\u7d44\u307f\u8fbc\u3080\u3053\u3068\u3067\u77ed\u3044URL\u3092\u751f\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4e00\u65b9\u3001Bitly API\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u306f\u3001\u77ed\u3044URL\u3092\u751f\u6210\u3057\u306a\u304c\u3089\u3001URL\u3054\u3068\u306e\u30af\u30ea\u30c3\u30af\u6570\u3001\u30af\u30ea\u30c3\u30af\u3055\u308c\u305fURL\u306e\u5834\u6240\u3001URL\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u306a\u3069\u3001\u4ed8\u968f\u3059\u308b\u6a5f\u80fd\u3092\u5229\u7528\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306e\u8aac\u660e\u3092\u8aad\u307f\u9032\u3081\u308b\u306b\u306f\u3001Python\u306b\u3064\u3044\u3066\u306e\u57fa\u672c\u7684\u306a\u77e5\u8b58\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002\u307e\u305f\u3001Python\u304c\u30b7\u30b9\u30c6\u30e0\u306b<a href=\"https:\/\/kinqsta.com\/jp\/blog\/install-python\/\">\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a>\u3055\u308c\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u4e8b\u524d\u306b\u3054\u78ba\u8a8d\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u74b0\u5883\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7<\/h2>\n<p>URL\u77ed\u7e2e\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3059\u308b\u524d\u306b\u3001Python\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u306e\u958b\u767a\u3092\u5bb9\u6613\u306b\u3059\u308b\u8efd\u91cf\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3042\u308b<a href=\"https:\/\/kinqsta.com\/jp\/blog\/flask-vs-django\/#what-is-flask\">Flask<\/a>\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u542b\u3081\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u74b0\u5883\u3092\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b9\u30c6\u30c3\u30d7\u304b\u3089\u59cb\u3081\u307e\u3059\u3002<\/p>\n<ul>\n<li><strong>url-shortener<\/strong>\u306e\u3088\u3046\u306a\u540d\u524d\u3067\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/li>\n<li>\u305d\u306e\u30d5\u30a9\u30eb\u30c0\u306e\u4e2d\u306b<strong>main.py<\/strong>\u3068\u3044\u3046\u7a7a\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/li>\n<li>Python\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u30b7\u30b9\u30c6\u30e0\u304b\u3089\u72ec\u7acb\u3057\u305f\u3082\u306e\u306b\u3059\u308b\u305f\u3081\u306b\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u4eee\u60f3\u74b0\u5883\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u30bf\u30fc\u30df\u30ca\u30eb\u3067<code>python -m venv myenv<\/code>\u3068\u3044\u3046\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3063\u3066\u74b0\u5883\u3092\u69cb\u7bc9\u3057\u307e\u3059\uff08\u3053\u306e\u5834\u5408\u3001\u74b0\u5883\u30d5\u30a1\u30a4\u30eb\u306f<strong>myenv<\/strong>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u914d\u7f6e\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\uff09\u3002<\/li>\n<li>\u304a\u4f7f\u3044\u306e\u30aa\u30da\u30ec\u30fc\u30c6\u30a3\u30f3\u30b0\u30b7\u30b9\u30c6\u30e0\u306b\u5bfe\u5fdc\u3059\u308b\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3063\u3066\u4eee\u60f3\u74b0\u5883\u3092\u6709\u52b9\u306b\u3057\u307e\u3059\uff08<strong>&lt;myenv&gt;<\/strong>\u306e\u90e8\u5206\u306f\u524d\u306e\u30b9\u30c6\u30c3\u30d7\u3067\u4f5c\u6210\u3057\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u540d\u524d\u306b\u306a\u308a\u307e\u3059\uff09\u3002\n<ul>\n<li><strong>Windows<\/strong>\uff1a<code>&lt;myenv&gt;Scriptsactivate.bat<\/code><\/li>\n<li><strong>Linux\/macOS<\/strong>\uff1a<code>source &lt;myenv&gt;\/bin\/activate<\/code><\/li>\n<\/ul>\n<\/li>\n<li>\u30b3\u30de\u30f3\u30c9<code>pip install flask<\/code>\u3092\u4f7f\u3063\u3066Flask\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/li>\n<li>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30d5\u30a9\u30eb\u30c0\u5185\u306b<strong>templates<\/strong>\u3068\u3044\u3046\u540d\u524d\u306e\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3057\u307e\u3059\uff08Flask\u306f\u3053\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304b\u3089<a href=\"https:\/\/kinqsta.com\/jp\/blog\/what-is-html\/\">HTML<\/a>\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\uff09\u3002<\/li>\n<\/ul>\n<p>\u3053\u3053\u307e\u3067\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u306e\u4f5c\u696d\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<figure style=\"width: 960px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kinqsta.com\/wp-content\/uploads\/2023\/12\/url-shortener-create-python-environment.jpg\" alt=\"Python\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u74b0\u5883\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306b\u30bf\u30fc\u30df\u30ca\u30eb\u306b\u5165\u529b\u3057\u305f\u30b3\u30de\u30f3\u30c9\" width=\"960\" height=\"613\"><figcaption class=\"wp-caption-text\">macOS\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u306e\u69d8\u5b50\uff08Python\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u3053\u3053\u307e\u3067\u306e\u9032\u6357\uff09<\/figcaption><\/figure>\n<h2>pyshorteners\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u7528\u3057\u3066URL\u77ed\u7e2e\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u3092\u69cb\u7bc9\u3059\u308b<\/h2>\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u74b0\u5883\u304c\u6574\u3063\u305f\u306e\u3067\u3001<strong>pyshorteners<\/strong>\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3063\u3066\u6700\u521d\u306eURL\u77ed\u7e2e\u30c4\u30fc\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067<strong>pyshorteners<\/strong>\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-bash\">pip install pyshorteners<\/code><\/pre>\n<h3>\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u57fa\u672c\u7684\u306a\u30e6\u30fc\u30b6\u30fc\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306e\u4f5c\u6210<\/h3>\n<p>\u6b21\u306b\u3001\u9577\u3044URL\u3092\u5165\u529b\u3057\u3066\u77ed\u3044URL\u3092\u751f\u6210\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u3068\u306a\u308b\u3001\u30e9\u30d9\u30eb\u3068\u5165\u529b\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u3042\u308b\u57fa\u672c\u7684\u306a\u30d5\u30a9\u30fc\u30e0\u3092HTML\u3067\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p><strong>templates<\/strong>\u30d5\u30a9\u30eb\u30c0\u306b<strong>form.html<\/strong>\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3001\u305d\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u5165\u529b\u3057\u4fdd\u5b58\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-html\">&lt;!DOCTYPE html&gt;\n&lt;html lang=\"en\"&gt;\n&lt;head&gt;\n  &lt;title&gt;URL\u77ed\u7e2e\u30c4\u30fc\u30eb&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n  &lt;h1&gt;URL\u3092\u697d\u3005\u77ed\u7e2e&lt;\/h1&gt;\n  &lt;form method=\"post\" action=\"\/\"&gt;\n    &lt;label for=\"url\"&gt;\u300chttps:\/\/\u300d\u3067\u59cb\u307e\u308bURL\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044&lt;\/label&gt;\n    &lt;input type=\"url\"\n      name=\"url\"\n      id=\"url\"\n      placeholder=\"https:\/\/www.xyz.com\"\n      pattern=\"https:\/\/.*\" size=\"50\"\n        value=\"{{old_url}}\"\n      required  \n    &gt;\n    &lt;button type=\"submit\" value=\"submit\"&gt;\u77ed\u7e2e\u5b9f\u884c&lt;\/button&gt;\n    &lt;br&gt;\n    &lt;label&gt;\u77ed\u7e2e\u5f8c\u306eURL&lt;\/label&gt;\n    &lt;input name=\"generated_url\" value=\"{{new_url}}\" style=\"margin-top: 10px; margin-left:35px\" size=\"50\"&gt;&lt;\/input&gt;\n  &lt;\/form&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n<p>\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u306b\u3088\u308a\u30012\u3064\u306e\u30e9\u30d9\u30eb\u30012\u3064\u306e\u5165\u529b\u30d5\u30a3\u30fc\u30eb\u30c9\u30011\u3064\u306e\u30dc\u30bf\u30f3\u306e\u3042\u308b\u30d5\u30a9\u30fc\u30e0\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><code>url<\/code>\u3068\u3044\u3046\u6700\u521d\u306e\u5165\u529b\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u9577\u3044URL\u3092\u5165\u529b\u3057\u307e\u3059\u3002\u3082\u30461\u3064\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u306f\u77ed\u3044URL\u3092\u751f\u6210\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3067\u3059\u3002<\/p>\n<p><code>url<\/code>\u5165\u529b\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u306f\u4ee5\u4e0b\u306e\u5c5e\u6027\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li><code>name<\/code>\uff1a\u8981\u7d20\uff08\u4f8b\uff1aURL\uff09\u3092\u8b58\u5225<\/li>\n<li><code>placeholder<\/code>\uff1aURL\u306e\u4f8b\u3092\u793a\u3059<\/li>\n<li><code>pattern<\/code>\uff1aURL\u306e\u30d1\u30bf\u30fc\u30f3\u3092\u6307\u5b9a\u3059\u308b\uff08<code>https:\/\/.*<\/code>\uff09<\/li>\n<li><code>required<\/code>\uff1a\u9001\u4fe1\u524d\u306bURL\u306e\u5165\u529b\u3092\u78ba\u8a8d\u3059\u308b<\/li>\n<li><code>value<\/code>\uff1a\u5143\u306eURL\u3092\u8868\u793a\u3059\u308b<\/li>\n<\/ul>\n<p>2\u756a\u76ee\u306e\u5165\u529b\u30d5\u30a3\u30fc\u30eb\u30c9\u306f<code>value<\/code>\u5c5e\u6027\u304c<code>new_url<\/code>\u306b\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\u3002<code>new_url<\/code>\u306f<strong>main.py<\/strong>\u30d5\u30a1\u30a4\u30eb\u304b\u3089<strong>pyshorteners<\/strong>\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u3088\u3063\u3066\u751f\u6210\u3055\u308c\u308b\u77ed\u3044URL\u3067\u3059\uff08\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u8aac\u660e\u3057\u307e\u3059\uff09\u3002<\/p>\n<p>\u5165\u529b\u30d5\u30a9\u30fc\u30e0\u306f\u4ee5\u4e0b\u306e\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<figure style=\"width: 779px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kinqsta.com\/wp-content\/uploads\/2023\/12\/python-url-shortener-entry-form.jpg\" alt=\"URL\u3092\u77ed\u7e2e\u3059\u308b\u30a6\u30a7\u30d6\u30d5\u30a9\u30fc\u30e0\u306e\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\" width=\"779\" height=\"227\"><figcaption class=\"wp-caption-text\">URL\u77ed\u7e2e\u7528\u306e\u30a6\u30a7\u30d6\u30d5\u30a9\u30fc\u30e0<\/figcaption><\/figure>\n<h3>pyshorteners\u3092\u4f7f\u3063\u305fURL\u306e\u77ed\u7e2e<\/h3>\n<p>\u30d5\u30a9\u30fc\u30e0\u304c\u3067\u304d\u305f\u306e\u3067\u3001Python\u3068<strong>pyshorteners<\/strong>\u3092\u4f7f\u3063\u3066URL\u77ed\u7e2e\u306e\u6a5f\u80fd\u3092\u8ffd\u52a0\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u9577\u3044URL\u3092\u77ed\u3044URL\u306b\u5909\u63db\u3059\u308b\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3057\u3001\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002\u5148\u307b\u3069\u4f5c\u6210\u3057\u305f<strong>main.py<\/strong>\u30d5\u30a1\u30a4\u30eb\u306b\u79fb\u52d5\u3057\u3001\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u5165\u529b\u3057\u3066\u4fdd\u5b58\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><code class=\"language-python\">from flask import Flask, render_template, request\nimport pyshorteners\napp = Flask(__name__)\n \n@app.route(\"\/\", methods=['POST', 'GET'])\ndef home():\n  if request.method==\"POST\":\n    url_received = request.form[\"url\"]\n    short_url = pyshorteners.Shortener().tinyurl.short(url_received)\n    return render_template(\"form.html\", new_url=short_url, old_url=url_received)\n  else:\n    return render_template('form.html')\n \nif __name__ == \"__main__\":\n app.run() \n<\/code><\/pre>\n<p>\u4e0a\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001<strong>pyshorteners<\/strong>\u30e9\u30a4\u30d6\u30e9\u30ea\u3068\u4ee5\u4e0b\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u3092Flask\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u304b\u3089\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<ul>\n<li><code>Flask<\/code>\uff1a\u4ee5\u524d\u7d39\u4ecb\u3057\u305fFlask\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u305d\u306e\u3082\u306e<\/li>\n<li><code>render_template<\/code>\uff1a<code>templates<\/code>\u30d5\u30a9\u30eb\u30c0\u304b\u3089HTML\u30d5\u30a1\u30a4\u30eb\u306e\u51fa\u529b\u3092\u751f\u6210\u3059\u308b\u305f\u3081\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u30d1\u30c3\u30b1\u30fc\u30b8<\/li>\n<li><code>request<\/code>\uff1a\u30e6\u30fc\u30b6\u30fc\u304cHTTP\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u4e00\u90e8\u3068\u3057\u3066\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u304b\u3089\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u306b\u9001\u4fe1\u3059\u308b\u3059\u3079\u3066\u306e\u30c7\u30fc\u30bf\u3092\u542b\u3080\u3001Flask\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/li>\n<\/ul>\n<p>\u6b21\u306b\u3001\u30d5\u30a9\u30fc\u30e0\u3067\u9001\u4fe1\u3055\u308c\u305fURL\u3092\u53d7\u3051\u53d6\u308a\u3001\u77ed\u3044URL\u3092\u51fa\u529b\u3059\u308b<code>home()<\/code>\u3068\u3044\u3046\u95a2\u6570\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<code>app.route()<\/code>\u30c7\u30b3\u30ec\u30fc\u30bf\u3092\u4f7f\u7528\u3057\u3066\u3001\u30a2\u30d7\u30ea\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u306b\u7279\u5b9a\u306eURL\u30eb\u30fc\u30c8\u306b\u95a2\u6570\u3092\u30d0\u30a4\u30f3\u30c9\u3057\u3001POST\/GET\u30e1\u30bd\u30c3\u30c9\u3067\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u51e6\u7406\u3057\u307e\u3059\u3002<\/p>\n<p><code>home()<\/code>\u95a2\u6570\u306e\u4e2d\u306b\u306f<code>if-else<\/code>\u6761\u4ef6\u6587\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p><code>if<\/code>\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3067\u306f\u3001<code>request.method==\"POST\"<\/code>\u306e\u5834\u5408\u3001<code>url_received<\/code>\u3068\u3044\u3046\u5909\u6570\u306b\u3001\u30d5\u30a9\u30fc\u30e0\u3067\u9001\u4fe1\u3055\u308c\u308bURL\u3067\u3042\u308b<code>request.form[\"url\"]<\/code>\u304c\u30bb\u30c3\u30c8\u3055\u308c\u307e\u3059\u3002<code>url<\/code>\u306f\u3001\u5148\u306b\u4f5c\u6210\u3057\u305fHTML\u30d5\u30a9\u30fc\u30e0\u3067\u5b9a\u7fa9\u3057\u305f\u5165\u529b\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u540d\u524d\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u6b21\u306b\u3001<code>short_url<\/code>\u3068\u3044\u3046\u5909\u6570\u304c<code>pyshorteners.Shortener().tinyurl.short(url_received)<\/code>\u306b\u30bb\u30c3\u30c8\u3055\u308c\u307e\u3059\u3002<br \/>\n\u3053\u3053\u3067\u306f\u3001<strong>pyshorteners<\/strong>\u30e9\u30a4\u30d6\u30e9\u30ea\u306e2\u3064\u306e\u30e1\u30bd\u30c3\u30c9\u3001<code>.Shortener()<\/code>\u3068<code>.short()<\/code>\u304c\u4f7f\u7528\u3055\u308c\u3066\u3044\u307e\u3059\u3002<code>.Shortener()<\/code>\u95a2\u6570\u306f<strong>pyshorteners<\/strong>\u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u3057\u3001<code>.short()<\/code>\u95a2\u6570\u306fURL\u3092\u5f15\u6570\u3068\u3057\u3066\u53d7\u3051\u53d6\u308a\u3001\u305d\u308c\u3092\u77ed\u7e2e\u3059\u308b\u5f79\u5272\u3092\u679c\u305f\u3057\u307e\u3059\u3002<\/p>\n<p><code>short()<\/code>\u95a2\u6570\u3067\u3042\u308b<code>tinyurl.short()<\/code>\u306f\u3001<strong>pyshorteners<\/strong>\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u6570\u3042\u308bAPI\u306e\u3072\u3068\u3064\u3067\u3059\u3002<code>osdb.short()<\/code>\u3082\u540c\u3058\u76ee\u7684\u3067\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><code>render_template()<\/code>\u95a2\u6570\u306f\u3001HTML\u30d5\u30a1\u30a4\u30eb\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067\u3042\u308b<strong>form.html<\/strong>\u3092\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3057\u3001\u5f15\u6570\u3092\u901a\u3057\u3066URL\u3092\u30d5\u30a9\u30fc\u30e0\u306b\u9001\u308a\u8fd4\u3059\u306e\u306b\u4f7f\u308f\u308c\u307e\u3059\u3002\u5f15\u6570<code>new_url<\/code>\u306f<code>short_url<\/code>\u306b\u3001<code>old_url<\/code>\u306f<code>url_received<\/code>\u306b\u8a2d\u5b9a\u3055\u308c\u307e\u3059\u3002<code>if<\/code>\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u306e\u30b9\u30b3\u30fc\u30d7\u306f\u3053\u3053\u3067\u7d42\u4e86\u3057\u307e\u3059\u3002<\/p>\n<p><code>else<\/code>\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3067\u306f\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u30e1\u30bd\u30c3\u30c9\u304c POST\u4ee5\u5916\u306e\u5834\u5408\u3001<strong>form.html <\/strong>HTML\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3060\u3051\u304c\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3055\u308c\u307e\u3059\u3002<\/p>\n<h3>pyshorteners\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u7528\u3057\u305fURL\u77ed\u7e2e\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u306e\u30c7\u30e2<\/h3>\n<p><strong>pyshorteners <\/strong>URL\u77ed\u7e2e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30c7\u30e2\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3057\u305f\u5f8c\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u30eb\u30fc\u30c8\u3067\u3042\u308b<strong>http:\/\/127.0.0.1:5000\/<\/strong>\u3092\u958b\u3044\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u30a6\u30a7\u30d6\u30d5\u30a9\u30fc\u30e0\u306e\u6700\u521d\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u597d\u304d\u306a\u30ea\u30f3\u30af\u3092\u8cbc\u308a\u4ed8\u3051\u307e\u3059\u3002<\/p>\n<figure style=\"width: 761px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kinqsta.com\/wp-content\/uploads\/2023\/12\/python-url-shortener-submit-python-library.jpg\" alt=\"\u30a6\u30a7\u30d6\u30d5\u30a9\u30fc\u30e0\u306b\u8cbc\u308a\u4ed8\u3051\u305f\u77ed\u7e2eURL\u306e\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\" width=\"761\" height=\"194\"><figcaption class=\"wp-caption-text\">pyshorteners\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u7528\u3057\u3066URL\u77ed\u7e2e\u6a5f\u80fd\u3092\u30c6\u30b9\u30c8\u3059\u308b<\/figcaption><\/figure>\n<p><strong>\u300c\u77ed\u7e2e\u5b9f\u884c<\/strong>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u3001\u300c\u77ed\u7e2e\u5f8c\u306eURL\u300d\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u30c9\u30e1\u30a4\u30f3\u3068\u3057\u3066<code>tinyurl<\/code>\u304c\u5165\u3063\u305f\u3001\u77ed\u3044URL\u304c\u51fa\u529b\u3055\u308c\u307e\u3059\u3002<\/p>\n<figure style=\"width: 771px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kinqsta.com\/wp-content\/uploads\/2023\/12\/python-url-shortener-result-python-library.jpg\" alt=\"\u30a6\u30a7\u30d6\u30d5\u30a9\u30fc\u30e0\u3067\u8fd4\u3055\u308c\u305f\u77ed\u3044URL\u3092\u793a\u3059\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\" width=\"771\" height=\"168\"><figcaption class=\"wp-caption-text\">pyshorteners\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u7528\u3057\u305fURL\u77ed\u7e2e\u306e\u7d50\u679c<\/figcaption><\/figure>\n<h2>Bitly API\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u7528\u3057\u3066URL\u77ed\u7e2e\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u3092\u69cb\u7bc9\u3059\u308b<\/h2>\n<p>\u3053\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001Bitly API\u3092\u4f7f\u7528\u3057\u3066URL\u77ed\u7e2e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u958b\u767a\u3057\u307e\u3059\u3002\u524d\u8ff0\u3057\u305f\u3088\u3046\u306b\u3001Bitly API\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u3082URL\u3092\u77ed\u7e2e\u3067\u304d\u3001\u30af\u30ea\u30c3\u30af\u6570\u3001\u5834\u6240\u3001\u4f7f\u7528\u3057\u305f\u30c7\u30d0\u30a4\u30b9\u306e\u7a2e\u985e\uff08PC\u3084\u30e2\u30d0\u30a4\u30eb\u306a\u3069\uff09\u3068\u3044\u3063\u305f\u8a73\u3057\u3044\u5206\u6790\u30c7\u30fc\u30bf\u306e\u78ba\u8a8d\u3082\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3057\u3066Bitly API\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-bash\">pip install bitly-api-py3\n<\/code><\/pre>\n<p>Bitly API\u3092\u4f7f\u7528\u3059\u308b\u306b\u306f\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\u304c\u5fc5\u8981\u3067\u3059\u3002<a href=\"https:\/\/bitly.com\/a\/sign_up\" target=\"_blank\" rel=\"noopener noreferrer\">Bitly<\/a>\u306b\u30b5\u30a4\u30f3\u30a2\u30c3\u30d7\u3059\u308b\u3053\u3068\u3067\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u30b5\u30a4\u30f3\u30a2\u30c3\u30d7\u5b8c\u4e86\u5f8c\u3001Bitly\u306b\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u3092\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/kinqsta.com\/wp-content\/uploads\/2023\/12\/bitly-dashboard-url-shortener-api.jpg\" alt=\"Bitly\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u306e\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\" width=\"1443\" height=\"642\"><\/p>\n<p>\u5de6\u30b5\u30a4\u30c9\u30d0\u30fc\u306e\u300c<strong>Settings<\/strong>\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u3001\u300c<strong>Developer settings<\/strong>\u300d\u306e\u4e0b\u306b\u3042\u308b\u300c<strong>API<\/strong>\u300d\u30bb\u30af\u30b7\u30e7\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n<p>\u4e0b\u306e\u753b\u50cf\u306e\u3088\u3046\u306b\u3001\u300c<strong>Generate token<\/strong>\u300d\u30dc\u30bf\u30f3\u306e\u4e0a\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3057\u3066\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\u3092\u751f\u6210\u3057\u307e\u3059\u3002\u30a2\u30d7\u30ea\u306e\u30b3\u30fc\u30c9\u3067\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u30c8\u30fc\u30af\u30f3\u3092\u4fdd\u7ba1\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<figure style=\"width: 1259px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kinqsta.com\/wp-content\/uploads\/2023\/12\/bitly-url-shortener-api-access-token.jpg\" alt=\"Bitly API\u306e\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\u751f\u6210\u753b\u9762\" width=\"1259\" height=\"677\"><figcaption class=\"wp-caption-text\">Bitly API\u306e\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\u3092\u751f\u6210\u3059\u308b<\/figcaption><\/figure>\n<h3>Bitly API\u3092\u4f7f\u3063\u305fURL\u306e\u77ed\u7e2e<\/h3>\n<p>Bitly\u304b\u3089\u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97\u3057\u305f\u306e\u3067\u3001\u4eca\u5ea6\u306fBitly API\u3092\u4f7f\u7528\u3057\u3066URL\u3092\u77ed\u7e2e\u3059\u308b\u30b3\u30fc\u30c9\u3092\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n<p><strong>pyshorteners<\/strong>\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u4f5c\u6210\u3057\u305f\u3082\u306e\u3068\u540c\u3058\u30d5\u30a9\u30fc\u30e0\u3092\u4f7f\u7528\u3057\u307e\u3059\u304c\u3001<strong>main.py<\/strong>\u30d5\u30a1\u30a4\u30eb\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3044\u304f\u3064\u304b\u306e\u5909\u66f4\u3092\u52a0\u3048\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-python\">from flask import Flask, render_template, request\nimport bitly_api\napp = Flask(__name__)\n \nbitly_access_token = \"37b1xxxxxxxxxxxxxxxxxxxxxxxxxx\"\n \n@app.route(\"\/\", methods=['POST', 'GET'])\ndef home():\n  if request.method==\"POST\":\n    url_received = request.form[\"url\"]\n    bitly = bitly_api.Connection(access_token=bitly_access_token)\n    short_url = bitly.shorten(url_received)\n    return render_template(\"form.html\", new_url=short_url.get('url'), old_url=url_received)\n  else:\n    return render_template('form.html')\n \nif __name__ == \"__main__\":\n app.run() \n<\/code><\/pre>\n<p>\u4e0a\u306e\u30b3\u30fc\u30c9\u304b\u3089\u308f\u304b\u308b\u3088\u3046\u306b\u3001<code>bitly_api<\/code>\u304c<code>import bitly_api<\/code>\u3092\u4f7f\u3063\u3066\u30a4\u30f3\u30dd\u30fc\u30c8\u3055\u308c\u307e\u3059\u3002\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\u306f<code>bitly_access_token = \"37b1xxxxxxxxxxxxxxxxxxxxxxxx\"<\/code>\u306e\u3088\u3046\u306b<code>bity_access_token<\/code>\u5909\u6570\u306b\u4fdd\u5b58\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><code>home()<\/code>\u95a2\u6570\u306fURL\u3092\u77ed\u7e2e\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3067\u3001<code>if-else<\/code>\u6761\u4ef6\u6587\u3092\u542b\u307f\u307e\u3059\u3002<\/p>\n<p><code>if<\/code>\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3067\u306f\u3001\u30e1\u30bd\u30c3\u30c9\u307e\u305f\u306f\u30ea\u30af\u30a8\u30b9\u30c8\u304c<code>POST<\/code>\u306e\u5834\u5408\u3001\u30d5\u30a9\u30fc\u30e0\u3067\u9001\u4fe1\u3055\u308c\u305fURL\u304c<code>url_received<\/code>\u5909\u6570\u306b\u8a2d\u5b9a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><code>bitly_api.Connection(access_token=bitly_access_token)<\/code>\u95a2\u6570\u306fBitly API\u306b\u63a5\u7d9a\u3057\u3001\u5148\u307b\u3069\u4fdd\u5b58\u3057\u305f\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\u3092\u5f15\u6570\u3068\u3057\u3066\u6e21\u3057\u307e\u3059\u3002<\/p>\n<p>URL\u3092\u77ed\u7e2e\u3059\u308b\u306b\u306f\u3001<code>url_received<\/code>\u5909\u6570\u3092\u5f15\u6570\u3068\u3057\u3066\u6e21\u3057\u3001<code>short_url<\/code>\u3068\u3044\u3046\u5909\u6570\u306b\u4fdd\u5b58\u3059\u308b\u304b\u305f\u3061\u3067<code>bitly.shorten()<\/code>\u95a2\u6570\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<p>\u6700\u5f8c\u306b\u3001\u4f5c\u6210\u3057\u305f\u30d5\u30a9\u30fc\u30e0\u304c\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3055\u308c\u3001<code>render_template()<\/code>\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u30d5\u30a9\u30fc\u30e0\u306b\u8868\u793a\u3055\u308c\u308bURL\u304c\u9001\u308a\u8fd4\u3055\u308c\u307e\u3059\u3002\u3053\u308c\u3067<code>if<\/code>\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u304c\u5b8c\u4e86\u3057\u307e\u3059\u3002<\/p>\n<p><code>else<\/code>\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3067\u306f\u3001<code>render_template()<\/code>\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u30d5\u30a9\u30fc\u30e0\u306e\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<h3>Bitly API\u3092\u4f7f\u7528\u3057\u305fURL\u77ed\u7e2e\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u306e\u30c7\u30e2<\/h3>\n<p>Bitly API URL \u77ed\u7e2e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30c7\u30e2\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3057\u305f\u5f8c\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u30eb\u30fc\u30c8\u3067\u3042\u308b<strong>http:\/\/127.0.0.1:5000\/<\/strong>\u306b\u79fb\u52d5\u3057\u307e\u3059\u3002<\/p>\n<p>\u30a6\u30a7\u30d6\u30d5\u30a9\u30fc\u30e0\u306e\u6700\u521d\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u4efb\u610f\u306e\u30ea\u30f3\u30af\u3092\u8cbc\u308a\u4ed8\u3051\u307e\u3059\u3002<\/p>\n<figure style=\"width: 759px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kinqsta.com\/wp-content\/uploads\/2023\/12\/python-url-shortener-submit-bitly-api.jpg\" alt=\"Bitly\u306eURL\u77ed\u7e2eAPI\u30a6\u30a7\u30d6\u30d5\u30a9\u30fc\u30e0\u306e\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\" width=\"759\" height=\"187\"><figcaption class=\"wp-caption-text\">Bitly API\u3092\u4f7f\u7528\u3057\u305fURL\u77ed\u7e2e\u6a5f\u80fd\u3092\u30c6\u30b9\u30c8\u3059\u308b<\/figcaption><\/figure>\n<p><strong>\u300c\u77ed\u7e2e\u5b9f\u884c<\/strong>\u300d\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u3001\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e2\u756a\u76ee\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u306b<code>bit.ly<\/code>\u3092\u30c9\u30e1\u30a4\u30f3\u3068\u3059\u308b\u77ed\u3044URL \u304c\u751f\u6210\u3055\u308c\u308b\u306f\u305a\u3067\u3059\u3002<\/p>\n<figure id=\"attachment_172516\" aria-describedby=\"caption-attachment-172516\" style=\"width: 765px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-172516 size-full\" src=\"https:\/\/kinqsta.com\/wp-content\/uploads\/2023\/12\/python-url-shortener-result-bitly-api.jpg\" alt=\"Bitly API\u304c\u8fd4\u3059\u77ed\u7e2eURL\u306e\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\" width=\"765\" height=\"192\"><figcaption id=\"caption-attachment-172516\" class=\"wp-caption-text\">Bitly API\u3092\u4f7f\u7528\u3057\u305fURL\u77ed\u7e2e\u306e\u7d50\u679c<\/figcaption><\/figure>\n<p>Python\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3068Bitly API\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u7c21\u5358\u306bURL\u3092\u77ed\u7e2e\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>URL\u77ed\u7e2e\u6a5f\u80fd\u3092\u4f7f\u3046\u3068\u3001\u77ed\u3044URL\u3092\u7c21\u5358\u306b\u5171\u6709\u3067\u304d\u3001\u898b\u305f\u76ee\u3082\u3059\u3063\u304d\u308a\u3057\u307e\u3059\u3002\u4eca\u56de\u306e\u8a18\u4e8b\u3067\u306fURL\u77ed\u7e2e\u6a5f\u80fd\u3068\u305d\u306e\u5229\u70b9\u3001\u305d\u3057\u3066<strong>pyshorteners<\/strong>\u3068Bitly API\u3092\u4f7f\u3063\u3066Python\u3067URL\u77ed\u7e2e\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3059\u308b\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<strong>pyshorteners<\/strong>\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3048\u3070\u77ed\u3044URL\u3092\u751f\u6210\u3067\u304d\u3001Bitly API\u3067\u306f\u77ed\u3044URL\u306e\u751f\u6210\u3060\u3051\u3067\u306a\u304f\u8a73\u7d30\u306a\u5206\u6790\u30c7\u30fc\u30bf\u3082\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3067\u4fbf\u5229\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u5b8c\u6210\u3067\u3059\u3002Kinsta\u306e<a href=\"https:\/\/sevalla.com\/application-hosting\/\">\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0\u30fc\u30b5\u30fc\u30d3\u30b9<\/a>\u3092\u4f7f\u3063\u3066\u3055\u307e\u3056\u307e\u306a\u30a2\u30a4\u30c7\u30a2\u3092\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002\u4eca\u56de\u3054\u7d39\u4ecb\u3057\u305f\u3088\u3046\u306aPython\u30a2\u30d7\u30ea\u3092Kinsta\u306e\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u3067\u7a3c\u50cd\u3055\u305b\u308b\u306b\u306f\u3001<a href=\"https:\/\/docs.sevalla.com\/templates\/overviewpython-examples#flask\">Flask\u306e\u6d3b\u7528\u4f8b<\/a>\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30e6\u30cb\u30d5\u30a9\u30fc\u30e0\u30fb\u30ea\u30bd\u30fc\u30b9\u30fb\u30ed\u30b1\u30fc\u30bf\uff08\u4e00\u822c\u7684\u306b\u306fURL\u3068 &#8230;<\/p>\n","protected":false},"author":303,"featured_media":54030,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kinsta_gated_content":false,"_kinsta_gated_content_redirect":"","footnotes":""},"tags":[],"topic":[801],"class_list":["post-54029","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","topic-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v24.6 (Yoast SEO v24.6) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python\u3067\u30b7\u30f3\u30d7\u30eb\u306aURL\u77ed\u7e2e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3059\u308b\u65b9\u6cd5\uff5cKinsta\u00ae<\/title>\n<meta name=\"description\" content=\"Python\u3067URL\u77ed\u7e2e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u7c21\u5358\u306b\u69cb\u7bc9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4eca\u56de\u306e\u8a18\u4e8b\u3067\u306f\u3001\u4eba\u6c17\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3068Bitly API\u7b49\u3092\u4f7f\u3063\u305fURL\u77ed\u7e2e\u30a2\u30d7\u30ea\u306e\u958b\u767a\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python\u3067\u30b7\u30f3\u30d7\u30eb\u306aURL\u77ed\u7e2e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3059\u308b\u65b9\u6cd5\" \/>\n<meta property=\"og:description\" content=\"Python\u3067URL\u77ed\u7e2e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u7c21\u5358\u306b\u69cb\u7bc9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4eca\u56de\u306e\u8a18\u4e8b\u3067\u306f\u3001\u4eba\u6c17\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3068Bitly API\u7b49\u3092\u4f7f\u3063\u305fURL\u77ed\u7e2e\u30a2\u30d7\u30ea\u306e\u958b\u767a\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/\" \/>\n<meta property=\"og:site_name\" content=\"Kinsta\u00ae\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Kinsta-Japan-334616080691171\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-31T17:26:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-02-02T08:51:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/kinqsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/01\/create-url-shortener-with-python.png\" \/>\n\t<meta property=\"og:image:width\" content=\"3042\" \/>\n\t<meta property=\"og:image:height\" content=\"1521\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Adarsh Chimnani\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:description\" content=\"Python\u3067URL\u77ed\u7e2e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u7c21\u5358\u306b\u69cb\u7bc9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4eca\u56de\u306e\u8a18\u4e8b\u3067\u306f\u3001\u4eba\u6c17\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3068Bitly API\u7b49\u3092\u4f7f\u3063\u305fURL\u77ed\u7e2e\u30a2\u30d7\u30ea\u306e\u958b\u767a\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/kinqsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/01\/create-url-shortener-with-python.png\" \/>\n<meta name=\"twitter:creator\" content=\"@Kinsta_JP\" \/>\n<meta name=\"twitter:site\" content=\"@Kinsta_JP\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"Adarsh Chimnani\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"3\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/\"},\"author\":{\"name\":\"Adarsh Chimnani\",\"@id\":\"https:\/\/kinqsta.com\/jp\/#\/schema\/person\/e3d220b27e98eebee1c07012c9b8822d\"},\"headline\":\"Python\u3067\u30b7\u30f3\u30d7\u30eb\u306aURL\u77ed\u7e2e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3059\u308b\u65b9\u6cd5\",\"datePublished\":\"2024-01-31T17:26:53+00:00\",\"dateModified\":\"2024-02-02T08:51:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/\"},\"wordCount\":242,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/kinqsta.com\/jp\/#organization\"},\"image\":{\"@id\":\"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/kinqsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/01\/create-url-shortener-with-python.png\",\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/\",\"url\":\"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/\",\"name\":\"Python\u3067\u30b7\u30f3\u30d7\u30eb\u306aURL\u77ed\u7e2e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3059\u308b\u65b9\u6cd5\uff5cKinsta\u00ae\",\"isPartOf\":{\"@id\":\"https:\/\/kinqsta.com\/jp\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/kinqsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/01\/create-url-shortener-with-python.png\",\"datePublished\":\"2024-01-31T17:26:53+00:00\",\"dateModified\":\"2024-02-02T08:51:31+00:00\",\"description\":\"Python\u3067URL\u77ed\u7e2e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u7c21\u5358\u306b\u69cb\u7bc9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4eca\u56de\u306e\u8a18\u4e8b\u3067\u306f\u3001\u4eba\u6c17\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3068Bitly API\u7b49\u3092\u4f7f\u3063\u305fURL\u77ed\u7e2e\u30a2\u30d7\u30ea\u306e\u958b\u767a\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/#primaryimage\",\"url\":\"https:\/\/kinqsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/01\/create-url-shortener-with-python.png\",\"contentUrl\":\"https:\/\/kinqsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/01\/create-url-shortener-with-python.png\",\"width\":3042,\"height\":1521},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/kinqsta.com\/jp\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\",\"item\":\"https:\/\/kinqsta.com\/jp\/topics\/python\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Python\u3067\u30b7\u30f3\u30d7\u30eb\u306aURL\u77ed\u7e2e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3059\u308b\u65b9\u6cd5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/kinqsta.com\/jp\/#website\",\"url\":\"https:\/\/kinqsta.com\/jp\/\",\"name\":\"Kinsta\u00ae\",\"description\":\"\u9ad8\u901f\u304b\u3064\u5805\u7262\u306a\u30d7\u30ec\u30df\u30a2\u30e0\u30b5\u30fc\u30d0\u30fc\u30b5\u30fc\u30d3\u30b9\",\"publisher\":{\"@id\":\"https:\/\/kinqsta.com\/jp\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/kinqsta.com\/jp\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ja\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/kinqsta.com\/jp\/#organization\",\"name\":\"Kinsta\",\"url\":\"https:\/\/kinqsta.com\/jp\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/kinqsta.com\/jp\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/kinqsta.com\/jp\/wp-content\/uploads\/sites\/6\/2023\/12\/kinsta-logo.jpeg\",\"contentUrl\":\"https:\/\/kinqsta.com\/jp\/wp-content\/uploads\/sites\/6\/2023\/12\/kinsta-logo.jpeg\",\"width\":500,\"height\":500,\"caption\":\"Kinsta\"},\"image\":{\"@id\":\"https:\/\/kinqsta.com\/jp\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/Kinsta-Japan-334616080691171\/\",\"https:\/\/x.com\/Kinsta_JP\",\"https:\/\/www.instagram.com\/kinstahosting\/\",\"https:\/\/www.linkedin.com\/company\/kinsta\/\",\"https:\/\/www.pinterest.com\/kinstahosting\/\",\"https:\/\/www.youtube.com\/c\/Kinsta\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/kinqsta.com\/jp\/#\/schema\/person\/e3d220b27e98eebee1c07012c9b8822d\",\"name\":\"Adarsh Chimnani\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/kinqsta.com\/jp\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cb9588403d8e1c2e58b61b5b31b7b831?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cb9588403d8e1c2e58b61b5b31b7b831?s=96&d=mm&r=g\",\"caption\":\"Adarsh Chimnani\"},\"description\":\"Adarsh is a web developer (MERN stack), passionate about game-level designing (Unity3D), and an anime enthusiast. He enjoys absorbing knowledge just out of curiosity, implementing what he has learned in the real world, and sharing that knowledge with others.\",\"url\":\"https:\/\/kinqsta.com\/jp\/blog\/author\/adarshchimnani\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python\u3067\u30b7\u30f3\u30d7\u30eb\u306aURL\u77ed\u7e2e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3059\u308b\u65b9\u6cd5\uff5cKinsta\u00ae","description":"Python\u3067URL\u77ed\u7e2e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u7c21\u5358\u306b\u69cb\u7bc9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4eca\u56de\u306e\u8a18\u4e8b\u3067\u306f\u3001\u4eba\u6c17\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3068Bitly API\u7b49\u3092\u4f7f\u3063\u305fURL\u77ed\u7e2e\u30a2\u30d7\u30ea\u306e\u958b\u767a\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/","og_locale":"ja_JP","og_type":"article","og_title":"Python\u3067\u30b7\u30f3\u30d7\u30eb\u306aURL\u77ed\u7e2e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3059\u308b\u65b9\u6cd5","og_description":"Python\u3067URL\u77ed\u7e2e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u7c21\u5358\u306b\u69cb\u7bc9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4eca\u56de\u306e\u8a18\u4e8b\u3067\u306f\u3001\u4eba\u6c17\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3068Bitly API\u7b49\u3092\u4f7f\u3063\u305fURL\u77ed\u7e2e\u30a2\u30d7\u30ea\u306e\u958b\u767a\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002","og_url":"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/","og_site_name":"Kinsta\u00ae","article_publisher":"https:\/\/www.facebook.com\/Kinsta-Japan-334616080691171\/","article_published_time":"2024-01-31T17:26:53+00:00","article_modified_time":"2024-02-02T08:51:31+00:00","og_image":[{"width":3042,"height":1521,"url":"https:\/\/kinqsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/01\/create-url-shortener-with-python.png","type":"image\/png"}],"author":"Adarsh Chimnani","twitter_card":"summary_large_image","twitter_description":"Python\u3067URL\u77ed\u7e2e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u7c21\u5358\u306b\u69cb\u7bc9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4eca\u56de\u306e\u8a18\u4e8b\u3067\u306f\u3001\u4eba\u6c17\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3068Bitly API\u7b49\u3092\u4f7f\u3063\u305fURL\u77ed\u7e2e\u30a2\u30d7\u30ea\u306e\u958b\u767a\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002","twitter_image":"https:\/\/kinqsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/01\/create-url-shortener-with-python.png","twitter_creator":"@Kinsta_JP","twitter_site":"@Kinsta_JP","twitter_misc":{"\u57f7\u7b46\u8005":"Adarsh Chimnani","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"3\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/#article","isPartOf":{"@id":"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/"},"author":{"name":"Adarsh Chimnani","@id":"https:\/\/kinqsta.com\/jp\/#\/schema\/person\/e3d220b27e98eebee1c07012c9b8822d"},"headline":"Python\u3067\u30b7\u30f3\u30d7\u30eb\u306aURL\u77ed\u7e2e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3059\u308b\u65b9\u6cd5","datePublished":"2024-01-31T17:26:53+00:00","dateModified":"2024-02-02T08:51:31+00:00","mainEntityOfPage":{"@id":"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/"},"wordCount":242,"commentCount":0,"publisher":{"@id":"https:\/\/kinqsta.com\/jp\/#organization"},"image":{"@id":"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/#primaryimage"},"thumbnailUrl":"https:\/\/kinqsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/01\/create-url-shortener-with-python.png","inLanguage":"ja","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/","url":"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/","name":"Python\u3067\u30b7\u30f3\u30d7\u30eb\u306aURL\u77ed\u7e2e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3059\u308b\u65b9\u6cd5\uff5cKinsta\u00ae","isPartOf":{"@id":"https:\/\/kinqsta.com\/jp\/#website"},"primaryImageOfPage":{"@id":"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/#primaryimage"},"image":{"@id":"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/#primaryimage"},"thumbnailUrl":"https:\/\/kinqsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/01\/create-url-shortener-with-python.png","datePublished":"2024-01-31T17:26:53+00:00","dateModified":"2024-02-02T08:51:31+00:00","description":"Python\u3067URL\u77ed\u7e2e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u7c21\u5358\u306b\u69cb\u7bc9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4eca\u56de\u306e\u8a18\u4e8b\u3067\u306f\u3001\u4eba\u6c17\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3068Bitly API\u7b49\u3092\u4f7f\u3063\u305fURL\u77ed\u7e2e\u30a2\u30d7\u30ea\u306e\u958b\u767a\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002","breadcrumb":{"@id":"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/"]}]},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/#primaryimage","url":"https:\/\/kinqsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/01\/create-url-shortener-with-python.png","contentUrl":"https:\/\/kinqsta.com\/jp\/wp-content\/uploads\/sites\/6\/2024\/01\/create-url-shortener-with-python.png","width":3042,"height":1521},{"@type":"BreadcrumbList","@id":"https:\/\/kinqsta.com\/jp\/blog\/url-shortener-with-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/kinqsta.com\/jp\/"},{"@type":"ListItem","position":2,"name":"Python","item":"https:\/\/kinqsta.com\/jp\/topics\/python\/"},{"@type":"ListItem","position":3,"name":"Python\u3067\u30b7\u30f3\u30d7\u30eb\u306aURL\u77ed\u7e2e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3059\u308b\u65b9\u6cd5"}]},{"@type":"WebSite","@id":"https:\/\/kinqsta.com\/jp\/#website","url":"https:\/\/kinqsta.com\/jp\/","name":"Kinsta\u00ae","description":"\u9ad8\u901f\u304b\u3064\u5805\u7262\u306a\u30d7\u30ec\u30df\u30a2\u30e0\u30b5\u30fc\u30d0\u30fc\u30b5\u30fc\u30d3\u30b9","publisher":{"@id":"https:\/\/kinqsta.com\/jp\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kinqsta.com\/jp\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ja"},{"@type":"Organization","@id":"https:\/\/kinqsta.com\/jp\/#organization","name":"Kinsta","url":"https:\/\/kinqsta.com\/jp\/","logo":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/kinqsta.com\/jp\/#\/schema\/logo\/image\/","url":"https:\/\/kinqsta.com\/jp\/wp-content\/uploads\/sites\/6\/2023\/12\/kinsta-logo.jpeg","contentUrl":"https:\/\/kinqsta.com\/jp\/wp-content\/uploads\/sites\/6\/2023\/12\/kinsta-logo.jpeg","width":500,"height":500,"caption":"Kinsta"},"image":{"@id":"https:\/\/kinqsta.com\/jp\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Kinsta-Japan-334616080691171\/","https:\/\/x.com\/Kinsta_JP","https:\/\/www.instagram.com\/kinstahosting\/","https:\/\/www.linkedin.com\/company\/kinsta\/","https:\/\/www.pinterest.com\/kinstahosting\/","https:\/\/www.youtube.com\/c\/Kinsta"]},{"@type":"Person","@id":"https:\/\/kinqsta.com\/jp\/#\/schema\/person\/e3d220b27e98eebee1c07012c9b8822d","name":"Adarsh Chimnani","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/kinqsta.com\/jp\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cb9588403d8e1c2e58b61b5b31b7b831?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cb9588403d8e1c2e58b61b5b31b7b831?s=96&d=mm&r=g","caption":"Adarsh Chimnani"},"description":"Adarsh is a web developer (MERN stack), passionate about game-level designing (Unity3D), and an anime enthusiast. He enjoys absorbing knowledge just out of curiosity, implementing what he has learned in the real world, and sharing that knowledge with others.","url":"https:\/\/kinqsta.com\/jp\/blog\/author\/adarshchimnani\/"}]}},"acf":[],"_links":{"self":[{"href":"https:\/\/kinqsta.com\/jp\/wp-json\/wp\/v2\/posts\/54029","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kinqsta.com\/jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kinqsta.com\/jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kinqsta.com\/jp\/wp-json\/wp\/v2\/users\/303"}],"replies":[{"embeddable":true,"href":"https:\/\/kinqsta.com\/jp\/wp-json\/wp\/v2\/comments?post=54029"}],"version-history":[{"count":6,"href":"https:\/\/kinqsta.com\/jp\/wp-json\/wp\/v2\/posts\/54029\/revisions"}],"predecessor-version":[{"id":54583,"href":"https:\/\/kinqsta.com\/jp\/wp-json\/wp\/v2\/posts\/54029\/revisions\/54583"}],"alternate":[{"embeddable":true,"hreflang":"en","title":"English","href":"https:\/\/kinqsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/54029\/translations\/en"},{"embeddable":true,"hreflang":"it","title":"Italian","href":"https:\/\/kinqsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/54029\/translations\/it"},{"embeddable":true,"hreflang":"pt","title":"Portuguese","href":"https:\/\/kinqsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/54029\/translations\/pt"},{"embeddable":true,"hreflang":"fr","title":"French","href":"https:\/\/kinqsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/54029\/translations\/fr"},{"embeddable":true,"hreflang":"de","title":"German","href":"https:\/\/kinqsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/54029\/translations\/de"},{"embeddable":true,"hreflang":"es","title":"Spanish","href":"https:\/\/kinqsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/54029\/translations\/es"},{"embeddable":true,"hreflang":"ja","title":"Japanese","href":"https:\/\/kinqsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/54029\/translations\/jp"},{"href":"https:\/\/kinqsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/54029\/tree"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kinqsta.com\/jp\/wp-json\/wp\/v2\/media\/54030"}],"wp:attachment":[{"href":"https:\/\/kinqsta.com\/jp\/wp-json\/wp\/v2\/media?parent=54029"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kinqsta.com\/jp\/wp-json\/wp\/v2\/tags?post=54029"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/kinqsta.com\/jp\/wp-json\/wp\/v2\/topic?post=54029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}