change_password and help_you

This commit is contained in:
2017-08-08 04:19:37 +08:00
parent a06a441de3
commit f969d17114
2 changed files with 40 additions and 7 deletions

View File

@ -3,6 +3,7 @@
# necessary modules
import requests
from bs4 import BeautifulSoup
from pprint import pprint
# configurations
import config
@ -72,10 +73,17 @@ class kuser_api:
return soup.find('body').get_text().replace('\n', '') == 'delete success'
# hand in a answer
def upload_answer(self, number):
response = self.session.get(config.URL + '/upLoadHw', params={'hwId': number})
self.session.get(config.URL + '/upLoadHw', params={'hwId': number})
response = self.session.post(config.URL + '/upLoadFile')
return response.text # unavailable
def change_password(self, password):
payload = {'pass': password,
'submit': 'sumit'}
response = self.session.post(config.URL + '/changePasswd', data=payload)
soup = BeautifulSoup(response.text, 'html.parser')
return str(soup.find('body')).split()[-2] == 'Success'
# for debug
def main():
pass