Python-100-Days/Day61-65/code/example09.py

17 lines
377 B
Python
Raw Normal View History

2018-06-04 00:31:38 +08:00
import robobrowser
def main():
b = robobrowser.RoboBrowser(parser='lxml')
b.open('https://github.com/login')
f = b.get_form(action='/session')
f['login'].value = 'jackfrued@gmail.com'
f['password'].value = 'yourpassword'
b.submit_form(f)
for a_tag in b.select('a[href]'):
print(a_tag.attrs['href'])
if __name__ == '__main__':
main()