Python Get属性在BeautifulGroup中为None
我试图从下面的网站获取API密钥,但在HTML中查找密钥时遇到问题<每次运行代码时,下面的代码>api_key都会出现Python Get属性在BeautifulGroup中为None,python,beautifulsoup,Python,Beautifulsoup,我试图从下面的网站获取API密钥,但在HTML中查找密钥时遇到问题api_key都会出现Null,尽管我已经明确地遵循了其他示例。我使用的解析器有问题吗 site_url = "https://developer.forecast.io/" site_html = urllib2.urlopen(site_url).read() site_soup = BeautifulSoup(site_html,"html.parser") api_key = site_soup.find("input"
Null
,尽管我已经明确地遵循了其他示例。我使用的解析器有问题吗
site_url = "https://developer.forecast.io/"
site_html = urllib2.urlopen(site_url).read()
site_soup = BeautifulSoup(site_html,"html.parser")
api_key = site_soup.find("input",{"id":"api_key"})
编辑:这是我正在查看的HTML:
<div class="row">
<div class="span10" id="api_keys">
<div class="well">
<h2>API Key</h2>
<span class="input-append">
<input id="api_key" type="text" value="47580427a2916a5059085b6a65fc3990"
API密钥
这就是您在浏览器中看到的HTML,对吗?你登录了吗?当我没有登录时,我在该页面的任何地方都看不到输入。我在浏览器中看到它,没错。我已登录。我必须用python登录,然后刮去它吗?你已经登录了,对吗?您的站点\u html
变量包含什么html?看起来您需要登录才能获取您提到的输入表单是的,我已登录。站点html不包含input
,但是:当我尝试site\u html.find(“input”)