-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmythweaver.py
31 lines (28 loc) · 1011 Bytes
/
mythweaver.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python
import md5
import requests
import sys
from lxml import etree
class MythWeaver:
def login(self, username, password):
self.session = requests.Session()
phash = md5.new(password).hexdigest()
url = "http://www.myth-weavers.com/login.php?do=login"
opts = {
'do': 'login',
'vb_login_username': username,
'vb_login_md5password': phash,
'vb_login_md5password_utf': phash,
's': '',
'security_token': 'guest'
}
response = self.session.post(url, data=opts)
return 'bbsessionhash' in response.cookies.get_dict()
def downloadSheet(self, sheetid):
url = "http://www.myth-weavers.com/sheet.php"
opts = {
'do': 'download',
'sheetid': sheetid
}
response = self.session.post(url, data=opts)
return etree.fromstring(response.content)