Google App Engine – Finding the location of a user using X- AppEngine

I am currently working on another project and it requires me to find the location of users who are accessing my site. After some research, I found that there is a Google’s public API that tracks the location of a user: X- AppEngine

X-AppEngine finds the location of a user using the IP address from HTTP header information. You can simply assign a variable to the below code.

self.request.headers.get('X-AppEngine-City')

It works like a charm. Without this, I would have had to find the IP address of a user using

self.request.remote_addr

then use one of the public APIs that converts the IP address into coordinates.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s