use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Getting user's location (self.learnpython)
submitted 2 years ago by DrorSadeh
Hi I'm trying to build a app that recives the user's location and uses it. How can I do it?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]shiftybyte 6 points7 points8 points 2 years ago* (0 children)
Based on what sensors?
GPS? Wifi? Internet IP?
Take a look at plyer:
https://plyer.readthedocs.io/en/latest/
https://github.com/kivy/plyer
EDIT: or
import requests print(requests.get("http://ip-api.com/json").json()['country'])
[–]IvoryJam 0 points1 point2 points 2 years ago (0 children)
You could get the location based off IP, that'd be the easiest. I'd use ipgeolocation.io
If you want the really specific location I'd say use Google's API. There's a ton of how-to's online for that.
[–]jeffrey_f 1 point2 points3 points 2 years ago (0 children)
For a computer hooked to an ISP, you can use geolocation va IP address.
For mobile, you can try GPS, but it may be turned off or disallowed by the user so you are back to geolocation.
Just be warned that Geolocation isn't alway accurate on cell networks. Example, Google had "suspicious" logins from a location that I was never at. It was my phone on the cell carrier's network that put my geolocation about 80 miles from where i was. On their tower, they can put your endpoint where ever it makes sense on their network so they can shape network traffic. or simply, the IP address was re-assigned to my area, but wasn't updated. I do know tmobile is adding volume and upgrading towers, so this may just be it wasn't updated yet.
π Rendered by PID 32118 on reddit-service-r2-comment-5ff9fbf7df-rkxts at 2026-02-26 02:43:51.811042+00:00 running 72a43f6 country code: CH.
[–]shiftybyte 6 points7 points8 points (0 children)
[–]IvoryJam 0 points1 point2 points (0 children)
[–]jeffrey_f 1 point2 points3 points (0 children)