
接口 自动化测试
基于Python的接口自动化测试
小寒老师
这个作者很懒,什么都没留下…
展开
-
Python CSV文件的操作
import csvfilename = "a directory path to csv file" def scoPy_read_csv_as_list(filename, delimiter=',', encoding = None): """ Reads a given CSV file and returns it as a list containing all rows as list with encoding=utf-8. """ file = open(filen.原创 2021-11-02 17:04:39 · 142 阅读 · 0 评论 -
2.获取Cookie 发送Post请求
import requests#通过Post请求,获取cookiedef get_cookie(): url = "http://xxx:8080/xxx/login" payload = 'password=123456&username=abc' headers = {'Content-Type': 'application/x-www-form-urlencoded'} session = requests.session() session.p.原创 2021-08-11 09:55:50 · 1726 阅读 · 0 评论 -
1.获取Token 再发送Get请求
#Post请求,获取Tokendef get_token(): url_login = r'http://xxx:8080/api/login' headers_login = { 'Content-Type': 'application/json;charset=UTF-8'} data = {'user': 'abc', 'password': '123456'} j_data = json.dumps(data) resp = requests.post(u.原创 2021-08-11 13:08:50 · 2141 阅读 · 4 评论