Created
May 31, 2015 12:51
-
-
Save yatt/bba18e34da315d14a1c2 to your computer and use it in GitHub Desktop.
login www.hatena.ne.jp using python3 (and requests package)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/python3.4 | |
| import requests | |
| name='*your username*' | |
| pwd='*your password*' | |
| s = requests.session() | |
| data = { | |
| 'name': name, | |
| 'password': pwd, | |
| } | |
| _ = s.post('https://www.hatena.ne.jp/login', data=data) | |
| r = s.get('http://d.hatena.ne.jp/{}/edit'.format(name)) | |
| with open('out.html', 'w', encoding='euc-jp') as ofs: | |
| ofs.write(r.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment