如何使用python访问任何用户的当前位置 [英] How to access current location of any user using python

查看:49
本文介绍了如何使用python访问任何用户的当前位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论如何,我是否可以通过python获取设备的位置.目前,我必须使用硒并打开浏览器,使用定位服务网站,并将其结果设置为经度/纬度变量.

Is there anyway that I can get the location of my device through python. Currently I am having to use selenium and open up a browser, use a location service website and setting the result of that to variables for lat/long.

但是有更简单的方法吗?

But is there an easier way to do this?

更新:我正在RaspberryPi上使用3G加密狗,因此正在寻找一种方法来获取特定的经度/纬度-我可以通过Web服务成功完成此操作,只是想知道python中是否内置了更快的方法这些请求吗?

UPDATE: I am using a 3G dongle on my RaspberryPi, so looking for a way to get the specific lat/long of it - I can successfully do this through web service, just wondering if there is a quicker way built into python for these requests?

推荐答案

或如此简单

import geocoder
g = geocoder.ip('me')
print(g.latlng)

这篇关于如何使用python访问任何用户的当前位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆