开发者

How do I supply latitude longitude info (got by JS ) on client machine to Python running on server?

  1. I tried using Google's GEOLOCATION api and html5 to get devic开发者_如何学Pythone location. Both methods get data using JavaScript.

  2. I also know I am able to get street/city name information from Google's GEOCODING api using JSON.

  3. I am also able to fetch map tiles from openstreetmaps/cloudemade from a specific latitude, longitude.

Big question now. Points 2 and 3 are done using Python. How do I supply lat/long info from point 1 to Python running on server?


If you are running Javascript code in your browser that needs to communicate with some Python code running somewhere else, then the easiest way to get them to communicate is by settings up an HTTPServer in Python. The javascript will then be able to make HTTP Requests to the Python server.

You'll probably be able to get by by just extending Python's built-in HTTP server class.

As far as the format via which you should send the data, I would recommend JSON, because Javascript in the browser and Python on the server side are able to "do JSON" fairly easily.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜