Python 网站不允许访问[使用请求单击链接]

Python 网站不允许访问[使用请求单击链接],python,html,python-3.x,web-scraping,python-requests,Python,Html,Python 3.x,Web Scraping,Python Requests,我正试图在我的学院ID的仪表板页面上创建一个链接(考勤链接)(在我使用请求编写了登录网站的脚本之后) 我获得了链接的href,并将其附加到网页的主URL,即href如下所示: 。/Student/studentattendenceview.aspx?SID=d5ZJjDPElr2gLui0QuBhtA==| KfGEwXYb8QU= 以及地址栏上链接的URL: http://erp.college_name.edu/Student/StudentAttendanceView.aspx?SID=d

我正试图在我的学院ID的仪表板页面上创建一个链接(考勤链接)(在我使用请求编写了登录网站的脚本之后)

我获得了链接的
href
,并将其附加到网页的主URL,即
href
如下所示:

。/Student/studentattendenceview.aspx?SID=d5ZJjDPElr2gLui0QuBhtA==| KfGEwXYb8QU=

以及地址栏上链接的URL:

http://erp.college_name.edu/Student/StudentAttendanceView.aspx?SID=d5ZJjDPElr2gLui0QuBhtA==|KfGEwXYb8QU=

因此,从
href
中删除两个
后,我将其附加到
http://erp.college_name.edu

问题是,当我试图从链接中获取
源代码文本时,网站不允许我这样做,我得到的不是(考勤链接页面的)源代码,而是:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Index</title>
    </head>

    <body>
        <center><img src="images/stop-sign-small2.jpg" /></center>
    </body>
</html>

你能提供一些你写的代码吗?此外,您还可以使用PhantomJS驱动程序模拟实际用户。您是否确实尝试过检查页面是否存在?当我转到
http://erp.college_name.edu/Student/StudentAttendanceView.aspx?SID=d5ZJjDPElr2gLui0QuBhtA==|KfGEwXYb8QU=
,我得到DNS错误,域名不知道。是的,我不知道为什么它也显示了这一点,
考勤
按钮的
href
不断地改变自己,我对
html
了解不多,但可能会在每个请求上生成一个新的链接,我在本项目的前一个问题中详细阐述了这个问题,即链接缩进在Python中是至关重要的。这是你发布的实际代码吗?如果使用Python将原始文件粘贴到控制台中,则会出现许多此类错误:
IndentationError:unexpected indent
import requests
from bs4 import BeautifulSoup

url = 'http://erp.college_name.edu/'

start = requests.session()
token = '3BA8C6EB'
token_1 = 'value'
stuff = {
    'tbUserName': 'my_usrname',
    'tbPassword': 'my_pass',
    '__VIEWSTATEGENERATOR': ''.join(token),
    'btnLogIn': 'Login',
    '__VIEWSTATE' : ''.join(token_1),
}

new_stuff = {
             '__EVENTTARGET' : '',
             '__EVENTARGUMENT': '',
             '__VIEWSTATE': 'value',
             'tbUserName': 'my_username',
             'tbPassword': 'my_pass',
             '__VIEWSTATEGENERATOR': '791C70D1',
             'btnLogIn': 'Login',
            }

opens = start.post(url=url, data=stuff)
soup = BeautifulSoup(opens.text, 'lxml')

for I in soup.find_all('div', class_='lPanel'):
    L = 'http://erp.college_name.edu' + str(I.findAll('li')
    [4].a.get('href')
    [2:])
    attendance = start.get(url=L, headers=new_stuff, data=stuff)
    print(attendance)