我一直在尝试通过一个请求,其中第一页是要传递到主页的数学演算。这部分解决了。但是,当我尝试获得其他东西时,我得到以下信息:
<script>
window.location.reload();
</script>
我已经学过这种方法有一段时间了,但直到现在我才第一次尝试它:
import re
import requests
def login_tokyo(s):
r = s.get('https://apcis.tmou.org/public/')
str_number = re.findall("<span[^>]+(.*?)</span>", r.text)[0]
numbers = re.findall('[0-9]+', str_number)
captcha = int(numbers[0]) + int(numbers[1])
payload = {'captcha': captcha}
r = s.post('https://apcis.tmou.org/public/?action=login', data=payload)
check_text = re.findall('<b>(.*?)</b>', r.text)[0]
print(check_text)
payload1 = {'Param': 0, 'Value': 5797164, 'imo': '', 'callsign': '', 'name': '', 'compimo': 5797164,
'compname': '', 'From': '01.06.2020', 'Till': '31.08.2020', 'authority': 0, 'flag': 0, 'class': 0,
'ro': 0, 'type': 0, 'result': 0, 'insptype': -1, 'sort1': 0, 'sort2': 'DESC', 'sort3': 0,
'sort4': 'DESC'
}
r = s.post('https://apcis.tmou.org/public/?action=getcompanies', data=payload1)
perf_tm = re.findall("<p class=[^>]+(.*?)</p>", r.text)
print(r.text)
print(perf_tm)
if __name__ == '__main__':
with requests.Session() as s:
login_tokyo(s)
告诉我我在print(check_text)主页上,但是……什么都没有。根据这个特定的要求,我希望print(perf_tm)能得到我的中等。感谢所有帮助!