使用bs4和urllib进行搜索查询

时间:2018-01-15 14:23:14

标签: python web-scraping beautifulsoup web-crawler

如何使用bs4和urllib进行搜索查询,查找搜索字段并将值放入字段并按提交(另一个具有令牌的网址)。

我试过这个,但这似乎没有登录。

import bs4 as bs
from urllib import request
from urllib import parse

# print(soup.text)

values ={'username': '1234567890',
               'password': 'mypassw'}

post_arg = parse.urlencode(values).encode('utf-8')

url = 'http://site24.way2sms.com/content/index.html?'

sauce = request.urlopen(url, post_arg)
soup = bs.BeautifulSoup(sauce, "lxml")
#print(sauce)


for i in soup.find_all('input', attrs={'id':'username'}):
  print(i)

#put values to input fields
#grab token, I can't find any csrf token.
#visit the desired webpage

0 个答案:

没有答案