当前位置:网站首页>0706-- replace fields in the use case, such as mobile phone number or ID
0706-- replace fields in the use case, such as mobile phone number or ID
2022-06-25 15:16:00 【Students' notes of Cai Cai make little progress every day】
Page page
The first 43 A video explaining
"""
-*- coding:utf-8 -*-
@Time :2021/6/23 11:37
@AUTHOR : Vegetable classmate
@SOFTWARE :lemon1
"""
"""
1、 stay EXCEL In the use case of ,mark The rules :# value # Use this to indicate that the current field needs to be replaced
2、 In use cases , When the mobile phone number needs to be replaced ,
Encapsulates the handle_data Defines the method replace_mark_with_data
Methods the internal :
Traverse case - Data for each request
If you find mark, The replacement
3、 A use case involves data , Yes url、request_data、check_sql
"""
def replace_mark_with_data(case,mark,real_data): # The body of the function
"""
Traverse a http Request all the data involved in the use case , If every data needs to be replaced , Will replace .
case: excel Read out a piece of data . It's a dictionary .
mark: Placeholder in data .# value #
real_data: To replace mark The real data .
"""
for key,value in case.items(): # Traverse the key values
if value is not None and isinstance(value,str): # If value Value is not null or value Is string
if value.find(mark) != -1: # If in value The value of this tag can be found in the value
case[key] = value.replace(mark,real_data) # Mark the mark Replace the real value
return case # Return the data
if __name__ == '__main__':
case = {
"method": "POST",
"url": "http://api.XXX.com/futureloan/#phone#/member/register",
"request_data": '{"mobile_phone": "#phone#", "pwd": "123456789", "type": 1, "reg_name": " Vegetable classmate 1"}'
}
if case["request_data"].find("#phone#") != -1: # If you can find it in the use case #phone# This field , Just replace
case = replace_mark_with_data(case,"#phone#",'123456789') # The ginseng
for key,value in case.items(): # Print after traversal
print(key,value)
边栏推荐
- Study notes of cmake
- Weka download and installation
- QT set process startup and self startup
- Custom structure type
- Why should the coroutine be set to non blocking IO
- The difference between sizeof and strlen
- How to deal with mining process
- Leetcode122 timing of buying and selling stocks II
- Source code analysis of synergetics and ntyco
- 2022年广东高考分数线出炉,一个几家欢喜几家愁
猜你喜欢

Master XSS completely from 0 to 1
![[paper notes] semi supervised object detection (ssod)](/img/18/9fba70e6e4329722d9c6ad51d15724.jpg)
[paper notes] semi supervised object detection (ssod)

Graphic control and layout basis of R visualization

Ubuntu 20.04 installing mysql8.0 and modifying the MySQL password

QT excel table read / write library - qtxlsx
![[try to hack] vulhub shooting range construction](/img/fc/6057b6dec9b51894140453e5422176.png)
[try to hack] vulhub shooting range construction

QQ情话糖果情话内容获取并保存

semget No space left on device

QQ love talk candy love talk content acquisition and storage

Learning notes on February 8, 2022 (C language)
随机推荐
2. operator and expression multiple choice questions
Position (5 ways)
Open a restaurant
[paper notes] semi supervised object detection (ssod)
Function of getinstance() method
QT excel table read / write library - qtxlsx
CV pre training model set
QT animation loading and closing window
Learning notes on February 8, 2022 (C language)
How to package rpm
(1) Introduction
Common dynamic memory errors
QT loading third-party library basic operation
Golang channel reading data
Leetcode121 timing of buying and selling stocks
Character encoding minutes
网上办理股票开户安全吗?
How to download and install Weka package
JS capture, target, bubble phase
[paper notes] overview of case segmentation