예제 #1
0
 def api_fb_set(self, url):
     headers = {'Content-Type': 'application/json'}
     data = {
         "action": "set",
         "name": "homepage",
         "value": "{\"news\":[5],\"notice\":[1],\"paper\":[5]}"
     }
     session = GetSession().get_session()
     return session.post(url, json=data, headers=headers)
예제 #2
0
 def api_upload(self, url):
     with open(BASE_PATH + os.sep + 'data' + os.sep + '我的头像.jpg',
               'rb') as f:
         headers = {
             'content-type':
             "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
         }
         file = {'upload1': f}
         session = GetSession().get_session()
         return session.post(url, files=file)
예제 #3
0
 def api_add_notice_post(self, url, title, content):
     headers = {'Content-Type': 'application/json'}
     data = {
         "action": "addone",
         "data": {
             "title": title,
             "content": content
         }
     }
     session = GetSession().get_session()
     return session.post(url, json=data, headers=headers)
예제 #4
0
 def api_set_info(self, name, url):
     headers = {'Content-Type': 'application/json'}
     params = {"action": "getmyprofile"}
     session = GetSession().get_session()
     data = {
         "action": "setmyprofile",
         "newdata": {
             "realname": name,
             "password": "******"
         }
     }
     return session.post(url, json=data, params=params, headers=headers)
예제 #5
0
 def api_add_account_post(self, url, realname, username, password, number, desc, type):
     headers = {'Content-Type': 'application/json'}
     data = {
         "action": "addone",
         "data": {
             "realname": realname,
             "username": username,
             "password": password,
             "studentno": number,
             "desc": desc,
             "usertype": type
         }
     }
     session = GetSession().get_session()
     return session.post(url, json=data, headers=headers)
예제 #6
0
 def api_click(self, url):
     headers = {'Content-Type': 'application/json'}
     data = {"action": "thumbuporcancel", "paperid": 5}
     session = GetSession().get_session()
     return session.post(url, json=data, headers=headers)