我学习了2天的python。我想...只需登录Instagram并获得令牌。只有控制台。所以我使用了机械化库..我需要你的帮助。
br = mechanize.Browser()
br.set_handle_robots(False)
response = br.open(AUTHORIZATION_URL)
br.select_form(nr=0)
br.form['username'] = '' # id
br.form['password'] = '' # password
br.find_control(type="submit").readonly = False
br.set_all_readonly(False)
br.form.set_value("1", nr=3)
mechanize.urlopen(br.form.click())
#br.submit()
“br.submit()”和“mechanize.urlopen(br.form.click())”出现http错误403。 这是错误代码。
Traceback (most recent call last):
File "C:\Users\3my\Desktop\Python\Instagram\InstagramByMechanize.py", line 25, in <module>
mechanize.urlopen(br.form.click())
File "build\bdist.win-amd64\egg\mechanize\_opener.py", line 426, in urlopen
File "build\bdist.win-amd64\egg\mechanize\_opener.py", line 204, in open
File "build\bdist.win-amd64\egg\mechanize\_urllib2_fork.py", line 457, in http_response
File "build\bdist.win-amd64\egg\mechanize\_opener.py", line 227, in error
File "build\bdist.win-amd64\egg\mechanize\_urllib2_fork.py", line 332, in _call_chain
File "build\bdist.win-amd64\egg\mechanize\_urllib2_fork.py", line 477, in http_error_default
urllib2.HTTPError: HTTP Error 403: FORBIDDEN
[Finished in 2.213s]
请帮帮我。 新年快乐:)