Skip to content

Instantly share code, notes, and snippets.

@yatt
Created May 31, 2015 12:51
Show Gist options
  • Select an option

  • Save yatt/bba18e34da315d14a1c2 to your computer and use it in GitHub Desktop.

Select an option

Save yatt/bba18e34da315d14a1c2 to your computer and use it in GitHub Desktop.
login www.hatena.ne.jp using python3 (and requests package)
#! /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