2

Possible Duplicate:
Get ip address of visitors using Python (specifically Flask micro-framework)

I'm creating REST api with flask. I want to allow requests only from one (or more later on) IP addresses. How do I check for IP address in my view?

Community
  • 1
  • 1
marcin_koss
  • 5,763
  • 10
  • 46
  • 65
  • 1
    very similar to http://stackoverflow.com/questions/3759981/get-ip-address-of-visitors-using-python-specifically-flask-micro-framework – ditkin Jun 01 '12 at 02:45
  • check https://stackoverflow.com/a/51928942/5588862 – Soli Feb 15 '20 at 13:23

2 Answers2

5

Get the headers from Incoming Request Data and find the REMOTE_ADDR

Mayli
  • 581
  • 4
  • 6
1

if you are using google app engine you would use self.request.remote_addr

Axesh Ajmera
  • 383
  • 2
  • 8