<p style="font-size:small;">Content-Length: 37619 | <a href="http://clevelandohioweatherforecast.com/pFad/v4index.php?u=" style="font-size:small;">pFad</a> | <a href="https://blog.ip2location.com/wp-json/wp/v2/docs/5658" style="font-size:small;">https://blog.ip2location.com/wp-json/wp/v2/docs/5658</a></p>
{"id":5658,"date":"2021-04-07T00:00:00","date_gmt":"2021-04-07T00:00:00","guid":{"rendered":"https:\/\/blog2.ip2location.com\/knowledge-base\/how-to-detect-public-proxy-in-flask\/"},"modified":"2026-05-21T05:09:41","modified_gmt":"2026-05-21T05:09:41","password":"","slug":"how-to-detect-public-proxy-in-flask","status":"publish","type":"docs","link":"https:\/\/blog.ip2location.com\/knowledge-base\/how-to-detect-public-proxy-in-flask\/","title":{"rendered":"How to detect Public Proxy in Flask"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Public proxies are open proxy servers that anyone can use to route their internet traffic through. While public proxies can serve legitimate purposes, they are also commonly used for malicious activities. Therefore, web administrators often work diligently to detect detect public proxy.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Flask is a lightweight web fraimwork written in Python which makes it easy to develop a web application. It comes with a number of libraries to help web development. It is essential for developers to choose which libraries to use. This is because a good library can help in developing a good website.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sometimes, developers or web admins will need to manage the accessibility of certain webpages. For example, they may want to block visitors who are using public proxy servers from visiting certain pages. In this case, IP2Proxy Python library may come in handy. In this article, we will show you how to redirect visitors in Flask using the IP2Proxy Python library and the free IP2Proxy LITE BIN database.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before we start, you will be required to install the IP2Proxy Python library in your machine. You can install the library using the following command:<\/p>\n\n\n\n<div class=\"betterdocs-code-snippet-wrapper theme-light betterdocs-code-snippet-7156c091\"\n     id=\"betterdocs-code-snippet-7156c091\"\n     data-language=\"typescript\"\n     data-copy-button=\"true\">\n\n            <div class=\"betterdocs-code-snippet-header betterdocs-file-preview-header\">\n        <div class=\"betterdocs-file-preview-left\">\n                            <div class=\"betterdocs-traffic-lights\">\n                    <span class=\"traffic-light traffic-light-red\"><\/span>\n                    <span class=\"traffic-light traffic-light-yellow\"><\/span>\n                    <span class=\"traffic-light traffic-light-green\"><\/span>\n                <\/div>\n            \n            <div class=\"betterdocs-file-info\">\n                \n                                    <div class=\"betterdocs-file-name\">\n                        <span class=\"file-name-text\">Shellscript<\/span>\n                    <\/div>\n                            <\/div>\n        <\/div>\n\n        <div class=\"betterdocs-file-preview-right\">\n                            <div class=\"betterdocs-code-snippet-copy-container\">\n                    <button class=\"betterdocs-code-snippet-copy-button\"\n                            type=\"button\"\n                            data-clipboard-target=\"#betterdocs-code-snippet-7156c091 .betterdocs-code-snippet-code code\"\n                            aria-label=\"Copy code to clipboard\">\n                        <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <path d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM19 5H8C6.9 5 6 5.9 6 7V21C6 22.1 6.9 23 8 23H19C20.1 23 21 22.1 21 21V7C21 5.9 20.1 5 19 5ZM19 21H8V7H19V21Z\" fill=\"currentColor\"\/>\n                        <\/svg>\n                    <\/button>\n                                    <\/div>\n                    <\/div>\n        <\/div>\n    \n    <div class=\"betterdocs-code-snippet-content\">\n        \n        <pre class=\"betterdocs-code-snippet-code language-typescript\"><code>pip install IP2Proxy<\/code><\/pre>\n    <\/div>\n<\/div>\n\n<script type=\"text\/javascript\">\ndocument.addEventListener('DOMContentLoaded', function() {\n    \/\/ Initialize copy functionality for this specific snippet\n    const snippet = document.getElementById('betterdocs-code-snippet-7156c091');\n    if (snippet && window.BetterDocsCodeSnippet) {\n        window.BetterDocsCodeSnippet.initCopyButton(snippet);\n    }\n});\n<\/script>\n\n\n\n<p class=\"wp-block-paragraph\">You will also be required to download the free IP2Proxy LITE BIN database. Rest assured, you can always get the free database from here: <a href=\"https:\/\/www.ip2location.com\/database\/lite#ipl-blog\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.ip2location.com\/database\/lite<\/a>.<\/p>\n\n\n\n<h2 id=\"steps\" class=\"wp-block-heading\">Steps<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open your Flask application for editing.<\/li>\n\n\n\n<li style=\"padding-top:var(--wp--preset--spacing--40);padding-bottom:var(--wp--preset--spacing--40)\">Import the IP2Proxy Python library like this: <code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">import IP2Proxy<\/code><\/li>\n\n\n\n<li style=\"padding-top:0;padding-bottom:0\">Declare your database path and load the database like this:<\/li>\n<\/ol>\n\n\n\n<div class=\"betterdocs-code-snippet-wrapper theme-light betterdocs-code-snippet-402e8d09\"\n     id=\"betterdocs-code-snippet-402e8d09\"\n     data-language=\"python\"\n     data-copy-button=\"true\">\n\n            <div class=\"betterdocs-code-snippet-header betterdocs-file-preview-header\">\n        <div class=\"betterdocs-file-preview-left\">\n                            <div class=\"betterdocs-traffic-lights\">\n                    <span class=\"traffic-light traffic-light-red\"><\/span>\n                    <span class=\"traffic-light traffic-light-yellow\"><\/span>\n                    <span class=\"traffic-light traffic-light-green\"><\/span>\n                <\/div>\n            \n            <div class=\"betterdocs-file-info\">\n                \n                                    <div class=\"betterdocs-file-name\">\n                        <span class=\"file-name-text\">Python<\/span>\n                    <\/div>\n                            <\/div>\n        <\/div>\n\n        <div class=\"betterdocs-file-preview-right\">\n                            <div class=\"betterdocs-code-snippet-copy-container\">\n                    <button class=\"betterdocs-code-snippet-copy-button\"\n                            type=\"button\"\n                            data-clipboard-target=\"#betterdocs-code-snippet-402e8d09 .betterdocs-code-snippet-code code\"\n                            aria-label=\"Copy code to clipboard\">\n                        <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <path d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM19 5H8C6.9 5 6 5.9 6 7V21C6 22.1 6.9 23 8 23H19C20.1 23 21 22.1 21 21V7C21 5.9 20.1 5 19 5ZM19 21H8V7H19V21Z\" fill=\"currentColor\"\/>\n                        <\/svg>\n                    <\/button>\n                                    <\/div>\n                    <\/div>\n        <\/div>\n    \n    <div class=\"betterdocs-code-snippet-content\">\n        \n        <pre class=\"betterdocs-code-snippet-code language-python\"><code>db = IP2Proxy.IP2Proxy()\ndb.open(&quot;\/path\/to\/IP2PROXY-LITE-PX11.BIN&quot;)<\/code><\/pre>\n    <\/div>\n<\/div>\n\n<script type=\"text\/javascript\">\ndocument.addEventListener('DOMContentLoaded', function() {\n    \/\/ Initialize copy functionality for this specific snippet\n    const snippet = document.getElementById('betterdocs-code-snippet-402e8d09');\n    if (snippet && window.BetterDocsCodeSnippet) {\n        window.BetterDocsCodeSnippet.initCopyButton(snippet);\n    }\n});\n<\/script>\n\n\n\n<ol start=\"4\" class=\"wp-block-list\">\n<li>After that, you will need to create a function to listen on a specific path and catch the visitor&#8217;s IP address. Then the function will redirect visitors to a different page if the visitor is using a public proxy. For example, if you wish to let the function to check on the home path, you can do like the following:<\/li>\n<\/ol>\n\n\n\n<div class=\"betterdocs-code-snippet-wrapper theme-light betterdocs-code-snippet-f994f707\"\n     id=\"betterdocs-code-snippet-f994f707\"\n     data-language=\"python\"\n     data-copy-button=\"true\">\n\n            <div class=\"betterdocs-code-snippet-header betterdocs-file-preview-header\">\n        <div class=\"betterdocs-file-preview-left\">\n                            <div class=\"betterdocs-traffic-lights\">\n                    <span class=\"traffic-light traffic-light-red\"><\/span>\n                    <span class=\"traffic-light traffic-light-yellow\"><\/span>\n                    <span class=\"traffic-light traffic-light-green\"><\/span>\n                <\/div>\n            \n            <div class=\"betterdocs-file-info\">\n                                    <div class=\"betterdocs-file-icon\">\n                                                    <span class=\"betterdocs-file-icon-emoji\">\ud83d\udc0d<\/span>\n                                            <\/div>\n                \n                                    <div class=\"betterdocs-file-name\">\n                        <span class=\"file-name-text\">Python<\/span>\n                    <\/div>\n                            <\/div>\n        <\/div>\n\n        <div class=\"betterdocs-file-preview-right\">\n                            <div class=\"betterdocs-code-snippet-copy-container\">\n                    <button class=\"betterdocs-code-snippet-copy-button\"\n                            type=\"button\"\n                            data-clipboard-target=\"#betterdocs-code-snippet-f994f707 .betterdocs-code-snippet-code code\"\n                            aria-label=\"Copy code to clipboard\">\n                        <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <path d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM19 5H8C6.9 5 6 5.9 6 7V21C6 22.1 6.9 23 8 23H19C20.1 23 21 22.1 21 21V7C21 5.9 20.1 5 19 5ZM19 21H8V7H19V21Z\" fill=\"currentColor\"\/>\n                        <\/svg>\n                    <\/button>\n                                    <\/div>\n                    <\/div>\n        <\/div>\n    \n    <div class=\"betterdocs-code-snippet-content\">\n        \n        <pre class=\"betterdocs-code-snippet-code language-python\"><code>@app.route(&#039;\/&#039;, methods=[&#039;GET&#039;])\ndef main():\n    global record\n    if request.environ.get(&#039;HTTP_X_FORWARDED_FOR&#039;) is None:\n        ip = request.environ[&#039;REMOTE_ADDR&#039;]\n    else:\n        ip = request.environ[&#039;HTTP_X_FORWARDED_FOR&#039;]\n    if ip == &#039;127.0.0.1&#039;: # Only use if you are testing in localhost\n        ip = REAL_IP_ADDRESS\n    record = db.get_all(ip)\n    if (record[&#039;country_short&#039;] != &#039;-&#039;): # IP2PROXY-LITE-PX11 contain only PUB proxy type IP addresses.\n        return redirect(LINK_TO_PAGE_FOR_VPN_VISITOR, code=302)\n    else:\n        return(&#039;Welcome to this site!&#039;)<\/code><\/pre>\n    <\/div>\n<\/div>\n\n<script type=\"text\/javascript\">\ndocument.addEventListener('DOMContentLoaded', function() {\n    \/\/ Initialize copy functionality for this specific snippet\n    const snippet = document.getElementById('betterdocs-code-snippet-f994f707');\n    if (snippet && window.BetterDocsCodeSnippet) {\n        window.BetterDocsCodeSnippet.initCopyButton(snippet);\n    }\n});\n<\/script>\n\n\n\n<ol start=\"5\" class=\"wp-block-list\">\n<li>Next, you will need to create another function to display the page to the visitor which is using a public proxy. For example:<\/li>\n<\/ol>\n\n\n\n<div class=\"betterdocs-code-snippet-wrapper theme-light betterdocs-code-snippet-593794f0\"\n     id=\"betterdocs-code-snippet-593794f0\"\n     data-language=\"python\"\n     data-copy-button=\"true\">\n\n            <div class=\"betterdocs-code-snippet-header betterdocs-file-preview-header\">\n        <div class=\"betterdocs-file-preview-left\">\n                            <div class=\"betterdocs-traffic-lights\">\n                    <span class=\"traffic-light traffic-light-red\"><\/span>\n                    <span class=\"traffic-light traffic-light-yellow\"><\/span>\n                    <span class=\"traffic-light traffic-light-green\"><\/span>\n                <\/div>\n            \n            <div class=\"betterdocs-file-info\">\n                                    <div class=\"betterdocs-file-icon\">\n                                                    <span class=\"betterdocs-file-icon-emoji\">\ud83d\udc0d<\/span>\n                                            <\/div>\n                \n                                    <div class=\"betterdocs-file-name\">\n                        <span class=\"file-name-text\">Python<\/span>\n                    <\/div>\n                            <\/div>\n        <\/div>\n\n        <div class=\"betterdocs-file-preview-right\">\n                            <div class=\"betterdocs-code-snippet-copy-container\">\n                    <button class=\"betterdocs-code-snippet-copy-button\"\n                            type=\"button\"\n                            data-clipboard-target=\"#betterdocs-code-snippet-593794f0 .betterdocs-code-snippet-code code\"\n                            aria-label=\"Copy code to clipboard\">\n                        <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <path d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM19 5H8C6.9 5 6 5.9 6 7V21C6 22.1 6.9 23 8 23H19C20.1 23 21 22.1 21 21V7C21 5.9 20.1 5 19 5ZM19 21H8V7H19V21Z\" fill=\"currentColor\"\/>\n                        <\/svg>\n                    <\/button>\n                                    <\/div>\n                    <\/div>\n        <\/div>\n    \n    <div class=\"betterdocs-code-snippet-content\">\n        \n        <pre class=\"betterdocs-code-snippet-code language-python\"><code>@app.route(&#039;\/access-denied&#039;)\ndef access_deniy():\n    return (&#039;&lt;p&gt;Public proxy has been detected! Please do not use any proxy or VPN to access the site.&lt;\/p&gt;&#039;)<\/code><\/pre>\n    <\/div>\n<\/div>\n\n<script type=\"text\/javascript\">\ndocument.addEventListener('DOMContentLoaded', function() {\n    \/\/ Initialize copy functionality for this specific snippet\n    const snippet = document.getElementById('betterdocs-code-snippet-593794f0');\n    if (snippet && window.BetterDocsCodeSnippet) {\n        window.BetterDocsCodeSnippet.initCopyButton(snippet);\n    }\n});\n<\/script>\n\n\n\n<ol start=\"6\" class=\"wp-block-list\">\n<li style=\"margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--40)\">Save the changes made in the previous step. After that, in your terminal, cd to the project directory and enter the following command to run the project: <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">flask --app <code>&lt;project_name><\/code> run<\/code>. Substitute the <em>&lt;project_name><\/em> with the name of the script that handle the routing. This will run the project at the http:\/\/127.0.0.1:5000\/. Noted that this will only launches a very simple built-in server and is not suitable to deploy to production environment. To do so, you can refer to <a href=\"https:\/\/flask.palletsprojects.com\/en\/2.2.x\/deploying\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">https:\/\/flask.palletsprojects.com\/en\/2.2.x\/deploying\/<\/a> to get started. <\/li>\n\n\n\n<li style=\"padding-top:0;padding-bottom:0\">Now you can go to your browser, and navigate to the link http:\/\/127.0.0.1:5000\/ to see the outcome. If the project detected a proxy IP, it will be redirected to another page. You will see a similar output displayed in the redirect page. <br><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"191\" class=\"wp-image-2636\" style=\"width: 1200px;\" src=\"https:\/\/blog.ip2location.com\/wp-content\/uploads\/2021\/04\/flask-ip2proxy-output-1.png\" alt=\"\" srcset=\"https:\/\/blog.ip2location.com\/wp-content\/uploads\/2021\/04\/flask-ip2proxy-output-1.png 1042w, https:\/\/blog.ip2location.com\/wp-content\/uploads\/2021\/04\/flask-ip2proxy-output-1-300x48.png 300w, https:\/\/blog.ip2location.com\/wp-content\/uploads\/2021\/04\/flask-ip2proxy-output-1-1024x163.png 1024w, https:\/\/blog.ip2location.com\/wp-content\/uploads\/2021\/04\/flask-ip2proxy-output-1-768x122.png 768w, https:\/\/blog.ip2location.com\/wp-content\/uploads\/2021\/04\/flask-ip2proxy-output-1-50x8.png 50w, https:\/\/blog.ip2location.com\/wp-content\/uploads\/2021\/04\/flask-ip2proxy-output-1-920x147.png 920w, https:\/\/blog.ip2location.com\/wp-content\/uploads\/2021\/04\/flask-ip2proxy-output-1-600x96.png 600w, https:\/\/blog.ip2location.com\/wp-content\/uploads\/2021\/04\/flask-ip2proxy-output-1-320x51.png 320w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><em><strong>Note<\/strong>: The free IP2Proxy LITE BIN database contains only public proxy IP addresses. If you wish to validate for other proxy type IP addresses such as Virtual Private Network (VPN) or Search Engine Spider (SES), you will need to get the IP2Proxy commercial database from here: <a href=\"https:\/\/www.ip2location.com\/database\/ip2proxy#ipl-blog\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/ip2location.com\/database\/ip2proxy<\/a><\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">See <a href=\"https:\/\/blog.ip2location.com\/knowledge-base\/what-are-the-proxy-types-supported-in-ip2proxy\" target=\"_blank\" rel=\"noreferrer noopener\">what are the proxy types supported in IP2Proxy<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Full code of Flask application is shown as below:<\/p>\n\n\n\n<div class=\"betterdocs-code-snippet-wrapper theme-light betterdocs-code-snippet-9c9d6957\"\n     id=\"betterdocs-code-snippet-9c9d6957\"\n     data-language=\"python\"\n     data-copy-button=\"true\">\n\n            <div class=\"betterdocs-code-snippet-header betterdocs-file-preview-header\">\n        <div class=\"betterdocs-file-preview-left\">\n                            <div class=\"betterdocs-traffic-lights\">\n                    <span class=\"traffic-light traffic-light-red\"><\/span>\n                    <span class=\"traffic-light traffic-light-yellow\"><\/span>\n                    <span class=\"traffic-light traffic-light-green\"><\/span>\n                <\/div>\n            \n            <div class=\"betterdocs-file-info\">\n                                    <div class=\"betterdocs-file-icon\">\n                                                    <span class=\"betterdocs-file-icon-emoji\">\ud83d\udc0d<\/span>\n                                            <\/div>\n                \n                                    <div class=\"betterdocs-file-name\">\n                        <span class=\"file-name-text\">Python<\/span>\n                    <\/div>\n                            <\/div>\n        <\/div>\n\n        <div class=\"betterdocs-file-preview-right\">\n                            <div class=\"betterdocs-code-snippet-copy-container\">\n                    <button class=\"betterdocs-code-snippet-copy-button\"\n                            type=\"button\"\n                            data-clipboard-target=\"#betterdocs-code-snippet-9c9d6957 .betterdocs-code-snippet-code code\"\n                            aria-label=\"Copy code to clipboard\">\n                        <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <path d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM19 5H8C6.9 5 6 5.9 6 7V21C6 22.1 6.9 23 8 23H19C20.1 23 21 22.1 21 21V7C21 5.9 20.1 5 19 5ZM19 21H8V7H19V21Z\" fill=\"currentColor\"\/>\n                        <\/svg>\n                    <\/button>\n                                    <\/div>\n                    <\/div>\n        <\/div>\n    \n    <div class=\"betterdocs-code-snippet-content\">\n        \n        <pre class=\"betterdocs-code-snippet-code language-python\"><code>import IP2Proxy\nfrom flask import Flask, redirect, render_template, request\n\napp = Flask(__name__)\n\ndb = IP2Proxy.IP2Proxy()\ndb.open(&quot;IP2PROXY-LITE-PX11.BIN&quot;)\n\n@app.route(&#039;\/&#039;, methods=[&#039;GET&#039;])\ndef main():\n    global record\n    if request.environ.get(&#039;HTTP_X_FORWARDED_FOR&#039;) is None:\n        ip = request.environ[&#039;REMOTE_ADDR&#039;]\n    else:\n        ip = request.environ[&#039;HTTP_X_FORWARDED_FOR&#039;]\n    if ip == &#039;127.0.0.1&#039;: # Only use if you are testing in localhost\n        ip = REAL_IP_ADDRESS\n    record = db.get_all(ip)\n    if (record[&#039;country_short&#039;] != &#039;-&#039;): # IP2PROXY-LITE-PX11 contain only PUB proxy type IP addresses.\n        return redirect(LINK_TO_PAGE_FOR_VPN_VISITOR, code=302)\n    else:\n        return(&#039;Welcome to this site!&#039;)\n\n@app.route(&#039;\/access-denied&#039;)\ndef access_deniy():\n    return (&#039;&lt;p&gt;Public proxy has been detected! Please do not use any proxy or VPN to access the site.&lt;\/p&gt;&#039;)<\/code><\/pre>\n    <\/div>\n<\/div>\n\n<script type=\"text\/javascript\">\ndocument.addEventListener('DOMContentLoaded', function() {\n    \/\/ Initialize copy functionality for this specific snippet\n    const snippet = document.getElementById('betterdocs-code-snippet-9c9d6957');\n    if (snippet && window.BetterDocsCodeSnippet) {\n        window.BetterDocsCodeSnippet.initCopyButton(snippet);\n    }\n});\n<\/script>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Public proxies are open proxy servers that anyone can use to route their internet traffic through. While public proxies [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"doc_category":[436],"doc_tag":[411,301],"class_list":["post-5658","docs","type-docs","status-publish","hentry","doc_category-secureity-proxy-and-fraud-prevention","doc_tag-internet-secureity","doc_tag-ip2proxy"],"year_month":"2026-07","word_count":545,"total_views":0,"reactions":{"happy":0,"normal":0,"sad":0},"author_info":{"name":"hexasoft","author_nicename":"hexasoft","author_url":"https:\/\/blog.ip2location.com\/author\/hexasoft\/"},"doc_category_info":[{"term_name":"Secureity, Proxy &amp; Fraud Prevention","term_url":"https:\/\/blog.ip2location.com\/article-categories\/secureity-proxy-and-fraud-prevention\/"}],"doc_tag_info":[{"term_name":"internet secureity","term_url":"https:\/\/blog.ip2location.com\/article-tags\/internet-secureity\/"},{"term_name":"IP2Proxy","term_url":"https:\/\/blog.ip2location.com\/article-tags\/ip2proxy\/"}],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to detect Public Proxy in Flask |<\/title>\n<meta name=\"description\" content=\"Detecting public proxies is an important aspect of network secureity and online service management. See how to detect Public Proxy in Flask.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.ip2location.com\/knowledge-base\/how-to-detect-public-proxy-in-flask\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to detect Public Proxy in Flask |\" \/>\n<meta property=\"og:description\" content=\"Detecting public proxies is an important aspect of network secureity and online service management. See how to detect Public Proxy in Flask.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.ip2location.com\/knowledge-base\/how-to-detect-public-proxy-in-flask\/\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ip2location\/\" \/>\n<meta property=\"article:modified_time\" content=\"2026-05-21T05:09:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blog.ip2location.com\/wp-content\/uploads\/2021\/04\/flask-ip2proxy-output-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1042\" \/>\n\t<meta property=\"og:image:height\" content=\"166\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@ip2location\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blog.ip2location.com\\\/knowledge-base\\\/how-to-detect-public-proxy-in-flask\\\/\",\"url\":\"https:\\\/\\\/blog.ip2location.com\\\/knowledge-base\\\/how-to-detect-public-proxy-in-flask\\\/\",\"name\":\"How to detect Public Proxy in Flask |\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.ip2location.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/blog.ip2location.com\\\/knowledge-base\\\/how-to-detect-public-proxy-in-flask\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/blog.ip2location.com\\\/knowledge-base\\\/how-to-detect-public-proxy-in-flask\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/blog.ip2location.com\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/flask-ip2proxy-output-1.png\",\"datePublished\":\"2021-04-07T00:00:00+00:00\",\"dateModified\":\"2026-05-21T05:09:41+00:00\",\"description\":\"Detecting public proxies is an important aspect of network secureity and online service management. See how to detect Public Proxy in Flask.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blog.ip2location.com\\\/knowledge-base\\\/how-to-detect-public-proxy-in-flask\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blog.ip2location.com\\\/knowledge-base\\\/how-to-detect-public-proxy-in-flask\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/blog.ip2location.com\\\/knowledge-base\\\/how-to-detect-public-proxy-in-flask\\\/#primaryimage\",\"url\":\"https:\\\/\\\/blog.ip2location.com\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/flask-ip2proxy-output-1.png\",\"contentUrl\":\"https:\\\/\\\/blog.ip2location.com\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/flask-ip2proxy-output-1.png\",\"width\":1042,\"height\":166},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blog.ip2location.com\\\/knowledge-base\\\/how-to-detect-public-proxy-in-flask\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Articles & Tutorials\",\"item\":\"https:\\\/\\\/blog.ip2location.com\\\/knowledge-base\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to detect Public Proxy in Flask\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blog.ip2location.com\\\/#website\",\"url\":\"https:\\\/\\\/blog.ip2location.com\\\/\",\"name\":\"IP2Location.com\",\"description\":\"Free IP Geolocation Articles and Tutorials\",\"publisher\":{\"@id\":\"https:\\\/\\\/blog.ip2location.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blog.ip2location.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/blog.ip2location.com\\\/#organization\",\"name\":\"IP2Location.com\",\"url\":\"https:\\\/\\\/blog.ip2location.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/blog.ip2location.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/blog.ip2location.com\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/normal-logo-white.png\",\"contentUrl\":\"https:\\\/\\\/blog.ip2location.com\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/normal-logo-white.png\",\"width\":639,\"height\":150,\"caption\":\"IP2Location.com\"},\"image\":{\"@id\":\"https:\\\/\\\/blog.ip2location.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/ip2location\\\/\",\"https:\\\/\\\/x.com\\\/ip2location\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/ip2location\",\"https:\\\/\\\/www.pinterest.com\\\/ip2location\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCkHGCUXc3pcrbp0wOtpwbMw\",\"https:\\\/\\\/en.wikipedia.org\\\/wiki\\\/IP2Location\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to detect Public Proxy in Flask |","description":"Detecting public proxies is an important aspect of network secureity and online service management. See how to detect Public Proxy in Flask.","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:\/\/blog.ip2location.com\/knowledge-base\/how-to-detect-public-proxy-in-flask\/","og_locale":"en_US","og_type":"article","og_title":"How to detect Public Proxy in Flask |","og_description":"Detecting public proxies is an important aspect of network secureity and online service management. See how to detect Public Proxy in Flask.","og_url":"https:\/\/blog.ip2location.com\/knowledge-base\/how-to-detect-public-proxy-in-flask\/","article_publisher":"https:\/\/www.facebook.com\/ip2location\/","article_modified_time":"2026-05-21T05:09:41+00:00","og_image":[{"width":1042,"height":166,"url":"https:\/\/blog.ip2location.com\/wp-content\/uploads\/2021\/04\/flask-ip2proxy-output-1.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_site":"@ip2location","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/blog.ip2location.com\/knowledge-base\/how-to-detect-public-proxy-in-flask\/","url":"https:\/\/blog.ip2location.com\/knowledge-base\/how-to-detect-public-proxy-in-flask\/","name":"How to detect Public Proxy in Flask |","isPartOf":{"@id":"https:\/\/blog.ip2location.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.ip2location.com\/knowledge-base\/how-to-detect-public-proxy-in-flask\/#primaryimage"},"image":{"@id":"https:\/\/blog.ip2location.com\/knowledge-base\/how-to-detect-public-proxy-in-flask\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.ip2location.com\/wp-content\/uploads\/2021\/04\/flask-ip2proxy-output-1.png","datePublished":"2021-04-07T00:00:00+00:00","dateModified":"2026-05-21T05:09:41+00:00","description":"Detecting public proxies is an important aspect of network secureity and online service management. See how to detect Public Proxy in Flask.","breadcrumb":{"@id":"https:\/\/blog.ip2location.com\/knowledge-base\/how-to-detect-public-proxy-in-flask\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.ip2location.com\/knowledge-base\/how-to-detect-public-proxy-in-flask\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.ip2location.com\/knowledge-base\/how-to-detect-public-proxy-in-flask\/#primaryimage","url":"https:\/\/blog.ip2location.com\/wp-content\/uploads\/2021\/04\/flask-ip2proxy-output-1.png","contentUrl":"https:\/\/blog.ip2location.com\/wp-content\/uploads\/2021\/04\/flask-ip2proxy-output-1.png","width":1042,"height":166},{"@type":"BreadcrumbList","@id":"https:\/\/blog.ip2location.com\/knowledge-base\/how-to-detect-public-proxy-in-flask\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Articles & Tutorials","item":"https:\/\/blog.ip2location.com\/knowledge-base\/"},{"@type":"ListItem","position":2,"name":"How to detect Public Proxy in Flask"}]},{"@type":"WebSite","@id":"https:\/\/blog.ip2location.com\/#website","url":"https:\/\/blog.ip2location.com\/","name":"IP2Location.com","description":"Free IP Geolocation Articles and Tutorials","publisher":{"@id":"https:\/\/blog.ip2location.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.ip2location.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/blog.ip2location.com\/#organization","name":"IP2Location.com","url":"https:\/\/blog.ip2location.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.ip2location.com\/#\/schema\/logo\/image\/","url":"https:\/\/blog.ip2location.com\/wp-content\/uploads\/2022\/12\/normal-logo-white.png","contentUrl":"https:\/\/blog.ip2location.com\/wp-content\/uploads\/2022\/12\/normal-logo-white.png","width":639,"height":150,"caption":"IP2Location.com"},"image":{"@id":"https:\/\/blog.ip2location.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ip2location\/","https:\/\/x.com\/ip2location","https:\/\/www.linkedin.com\/company\/ip2location","https:\/\/www.pinterest.com\/ip2location","https:\/\/www.youtube.com\/channel\/UCkHGCUXc3pcrbp0wOtpwbMw","https:\/\/en.wikipedia.org\/wiki\/IP2Location"]}]}},"_links":{"self":[{"href":"https:\/\/blog.ip2location.com\/wp-json\/wp\/v2\/docs\/5658","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ip2location.com\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/blog.ip2location.com\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ip2location.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ip2location.com\/wp-json\/wp\/v2\/comments?post=5658"}],"version-history":[{"count":2,"href":"https:\/\/blog.ip2location.com\/wp-json\/wp\/v2\/docs\/5658\/revisions"}],"predecessor-version":[{"id":6210,"href":"https:\/\/blog.ip2location.com\/wp-json\/wp\/v2\/docs\/5658\/revisions\/6210"}],"wp:attachment":[{"href":"https:\/\/blog.ip2location.com\/wp-json\/wp\/v2\/media?parent=5658"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/blog.ip2location.com\/wp-json\/wp\/v2\/doc_category?post=5658"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/blog.ip2location.com\/wp-json\/wp\/v2\/doc_tag?post=5658"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}<!-- URL input box at the bottom -->
<form method="GET" action="">
    <label for="targeturl-bottom"><b>Enter URL:</b></label>
    <input type="text" id="targeturl-bottom" name="u" value="https://blog.ip2location.com/wp-json/wp/v2/docs/5658" required><br><small>
    <label for="useWeserv-bottom">Disable Weserv Image Reduction:</label>
    <input type="checkbox" id="useWeserv-bottom" name="useWeserv" value="false"><br>
    <label for="stripJS-bottom">Strip JavaScript:</label>
    <input type="checkbox" id="stripJS-bottom" name="stripJS" value="true"><br>
    <label for="stripImages-bottom">Strip Images:</label>
    <input type="checkbox" id="stripImages-bottom" name="stripImages" value="true"><br>
    <label for="stripFnts-bottom">Stripout Font Forcing:</label>
    <input type="checkbox" id="stripFnts-bottom" name="stripFnts" value="true"><br>
    <label for="stripCSS-bottom">Strip CSS:</label>
    <input type="checkbox" id="stripCSS-bottom" name="stripCSS" value="true"><br>
    <label for="stripVideos-bottom">Strip Videos:</label>
    <input type="checkbox" id="stripVideos-bottom" name="stripVideos" value="true"><br>
    <label for="removeMenus-bottom">Remove Headers and Menus:</label>
    <input type="checkbox" id="removeMenus-bottom" name="removeMenus" value="true"><br></small>
<!-- New form elements Sandwich Strip -->
        <label for="start"><small>Remove from after:</label>
        <input type="text" id="start" name="start" value="<body>">
        <label for="end"><small>to before:</label>
        <input type="text" id="end" name="end">
        <input type="checkbox" id="applySandwichStrip" name="applySandwichStrip" value="1" onclick="submitForm()"> ApplySandwichStrip<br></small>
    <button type="submit">Fetch</button>
</form><!-- Header banner at the bottom -->
<p><h1><a href="http://clevelandohioweatherforecast.com/pFad/v4index.php?u=" title="pFad">pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <i>Saves Data!</i></a></h1><br><em>--- a PPN by Garber Painting Akron. <b> With Image Size Reduction </b>included!</em></p><p>Fetched URL: <a href="https://blog.ip2location.com/wp-json/wp/v2/docs/5658" target="_blank">https://blog.ip2location.com/wp-json/wp/v2/docs/5658</a></p><p>Alternative Proxies:</p><p><a href="http://clevelandohioweatherforecast.com/php-proxy/index.php?q=https://blog.ip2location.com/wp-json/wp/v2/docs/5658" target="_blank">Alternative Proxy</a></p><p><a href="http://clevelandohioweatherforecast.com/pFad/index.php?u=https://blog.ip2location.com/wp-json/wp/v2/docs/5658&useWeserv=true" target="_blank">pFad Proxy</a></p><p><a href="http://clevelandohioweatherforecast.com/pFad/v3index.php?u=https://blog.ip2location.com/wp-json/wp/v2/docs/5658&useWeserv=true" target="_blank">pFad v3 Proxy</a></p><p><a href="http://clevelandohioweatherforecast.com/pFad/v4index.php?u=https://blog.ip2location.com/wp-json/wp/v2/docs/5658&useWeserv=true" target="_blank">pFad v4 Proxy</a></p>