Skip to content

Commit

Permalink
Fix bug on Ubuntu.
Browse files Browse the repository at this point in the history
  • Loading branch information
liuwons committed Feb 23, 2016
1 parent 08dad11 commit 3fe6699
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions wxbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def init(self):
params = {
'BaseRequest': self.base_request
}
r = self.session.post(url, json=params)
r = self.session.post(url, data=json.dumps(params))
r.encoding = 'utf-8'
dic = json.loads(r.text)
self.sync_key = dic['SyncKey']
Expand All @@ -145,14 +145,14 @@ def status_notify(self):
"ToUserName": self.user['UserName'],
"ClientMsgId": int(time.time())
}
r = self.session.post(url, json=params)
r = self.session.post(url, data=json.dumps(params))
r.encoding = 'utf-8'
dic = json.loads(r.text)
return dic['BaseResponse']['Ret'] == 0

def get_contact(self):
url = self.base_uri + '/webwxgetcontact?pass_ticket=%s&skey=%s&r=%s' % (self.pass_ticket, self.skey, int(time.time()))
r = self.session.post(url, json={})
r = self.session.post(url, data='{}')
r.encoding = 'utf-8'
if self.DEBUG:
with open('contacts.json', 'w') as f:
Expand Down Expand Up @@ -228,7 +228,7 @@ def sync(self):
'SyncKey': self.sync_key,
'rr': ~int(time.time())
}
r = self.session.post(url, json=params)
r = self.session.post(url, data=json.dumps(params))
r.encoding = 'utf-8'
dic = json.loads(r.text)
if dic['BaseResponse']['Ret'] == 0:
Expand Down Expand Up @@ -521,8 +521,8 @@ def search_content(self, key, content, fmat = 'attr'):

def run(self):
self.get_uuid()
self.gen_qr_code('qr.jpg')
print '[INFO] Please use WeCaht to scan QR code in qr.jpg .'
self.gen_qr_code('qr.png')
print '[INFO] Please use WeCaht to scan QR code in qr.png .'
self.wait4login(1)
print '[INFO] Please confirm to login .'
self.wait4login(0)
Expand Down

0 comments on commit 3fe6699

Please sign in to comment.