Python中的HTTP请求和JSON解析 [英] HTTP requests and JSON parsing in Python

查看:248
本文介绍了Python中的HTTP请求和JSON解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过Google Directions API动态查询Google Maps.例如,此请求计算通过伊利诺伊州芝加哥到密苏里州乔普林和俄克拉荷马州俄克拉荷马城的两个航路点的路线:

I want to dynamically query Google Maps through the Google Directions API. As an example, this request calculates the route from Chicago, IL to Los Angeles, CA via two waypoints in Joplin, MO and Oklahoma City, OK:

它以JSON格式返回结果

It returns a result in the JSON format.

如何在Python中执行此操作?我想发送这样的请求,接收结果并进行解析.

How can I do this in Python? I want to send such a request, receive the result and parse it.

推荐答案

我建议使用很棒的 JSON响应内容: http://docs .python-requests.org/en/latest/user/quickstart/#json-response-content

JSON Response Content: http://docs.python-requests.org/en/latest/user/quickstart/#json-response-content

这篇关于Python中的HTTP请求和JSON解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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