1

hi i have made a really basic example here to attempt to make this easy to understand, i have a simple flask api that returns a single string, it is fully accessible using localhost, but i want to be able to access it from outside of the local network. i have created a firewall rule that allows TCP traffic in and out on port 5000, but despite this, it does not work. this is currently running in a pycharm community edition IDE, but i have ran it from command line aswell with the same results.

Why can i not access it using http://[IP]:5000/test

my end goal is to be able to access it from any identity given using Tor service using Torrequests module, but to get that far i need to be able to access it externally in the first place

from flask import Flask, request
from flask_restful import Resource, Api
import logging

app = Flask(__name__)
api = Api(app)


class Test(Resource):
    def post(self):
        return "worked"

    def get(self):
        return "worked"

api.add_resource(Test, '/test', methods=['GET', 'POST'])

if __name__ == "__main__":
    app.run(debug=False ,host='0.0.0.0', port=5000)
Simon L
  • 23
  • 4
  • Your ISP has likely blocked port 5000 as that's the UPnP port. Try a different port. Alternatively your ISP could have also used [carrier grade NAT](https://stackoverflow.com/questions/10291759/upnp-nat-traversal-for-3g-4g-wireless-data-connection-on-android) which would make it impossible for you to host a publicly available server as the setup at the ISP level block all connection requests to your server. – metatoaster Jun 20 '22 at 02:35
  • ive tried using port 25565 aswell, im using Virgin Media internet, soon will be in a house that uses Gigaclear and im unsure on either of their policies, would be tragic if i cannot get this to work as this is what my degree project is based on, using Tor as a basis for accessing my API, which is why i built a little test one for this question – Simon L Jun 20 '22 at 02:40
  • You probably need to consult the documentation (and probably the ToS) provided by your ISP and see if hosting servers is a possibility. With the exhaustion of IPv4 many ISPs do not have a policy to avoid CGNAT or charge extra for a static IPv4. Alternatively look at getting yourself a [VPS](https://stackoverflow.com/questions/109631/finding-the-right-vps) or if that's too expensive, look at cloud based computing on-demand servers (such as Amazon EC2, Digital Ocean, Google Cloud, Linode, Microsoft Azure) and see their free trial plans/service offerings. Or check with your Educational Provider. – metatoaster Jun 20 '22 at 02:46
  • its unfortunate because its a very small simple API just for my project, and if im not able to get it to work with the other ISP then im in a bit of a pickle, but thanks for the help lad – Simon L Jun 20 '22 at 02:58

0 Answers0