当前位置:网站首页>Post - payload of interface test

Post - payload of interface test

2022-06-11 07:53:00 zljun8210

Project use Post Method , Parameter use payload, The code is as follows :

# -*- coding: utf-8 -*-
"""
-------------------------------------------------
   File Name:     LoginsTest.py
   Description :
   Author :         Zeng Liangjun 
   QQ:             277099728
   Date:          8/11/2021 3:46 PM
-------------------------------------------------
   Change Activity:
                   8/11/2021:
-------------------------------------------------
"""
__author__ = 'ljzeng'

import requests
url = 'http://*/Login.aspx?tp=dologin'
username = 'username'
password = 'password'
ss = username + 'ª' + password
payload = ss.encode('utf8')
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36',
    'Content-Type': 'text/plain;charset=UTF-8'}

req = requests.post(url=url, data=payload, headers=headers)
list = []
for a in req.text.split(','):
    list += [a]

resu = list[0].split(':')[1]

if resu !=str(0):
    mess = list[1].split(':')[1]
    mess = mess[1:-1]
    print(" Login failed ! ")
    print(mess)
else:
    jumpurl = list[2][11:-1]
    print(" Login successful ! ")
    print(' Jump to : ', jumpurl)

原网站

版权声明
本文为[zljun8210]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203020516110872.html