【发布时间】:2017-04-05 15:32:37
【问题描述】:
https://maps.googleapis.com/maps/api/geocode/json?address=1+acmh宾夕法尼亚+1&key =
我可以通过直接将此链接粘贴到我的浏览器中来获取数据 但我需要对许多不同的地方进行地理编码 我试过了
import json
import re
from urllib.request import urlopen
from bs4 import BeautifulSoup
url = "https://maps.googleapis.com/maps/api/geocode/json?address=1+acmh pennsylvania+1&key = <YOUR KEY HERE>"
content = urlopen(url).read().decode('utf-8')
info = json.loads(content)
返回“错误请求”
【问题讨论】:
-
把
urlopen(api)改成urlopen(url),然后你的代码就可以用了