Search code examples
pythongeolocation

Python: Getting the user's country automatically?


There's probably an easy way to do this with some API, but web programming is not my forte. How can I figure out the user's country in Python? I need to use an OS-agnostic solution, and I'd prefer to only have to use the standard library. Is there something I can do with IP addresses, maybe?


Solution

  • Joran Beasely gave a good answer here, but since it came in the form of a comment rather than a reply I can't mark it as my accepted answer. Still, thanks for the help!