当前位置:网站首页>Two ways of using reuqests in RF
Two ways of using reuqests in RF
2022-06-11 23:13:00 【InfoQ】
1. Use python requests library
install
pip install requestsUse
- (1) Respectively called requests Specific methods in
res = requests.get(url)
res = requests.post(url)
res = requests.put(url)
res = requests.patch(url)
res = requests.options(url)
res = requests.head(url)
res = requests.delete(url)
- (2) Use request Method
res = requests.request('GET', url)
res = requests.request('OPTIONS', url)
res = requests.request('HEAD', url)
res = requests.request('POST', url)
res = requests.request('PUT', url)
res = requests.request('PATCH', url)
res = requests.request('DELETE', url)
give an example
def get_interface_request_duration(self, url_list, cookie_dict):
url_duration_dict = {}
for url in url_list:
respones = requests.request('GET', url=url, headers=cookie_dict,allow_redirects=False)
duration = respones.elapsed.total_seconds()
url_duration_dict[url] = duration
return url_duration_dict

1. Use RF Third party library RequestsLibrary
install
pip install robotframework-requestsUse
example
*** Settings ***
Library RequestsLibrary
*** Test Cases ***
001_TC_test interface
${url_list} set variable url1 url2
get_interface_request_duration ${url_list}
***Keywords***
get_interface_request_duration
[Arguments] @{url_list} ${mocker_cookie_dict}=${EMPTY}
FOR ${url} IN ${url_list}
${RES} GET ${url} headers=${mocker_cookie_dict}
log ${RES.elapsed.total_seconds()}
边栏推荐
- A method of relay for ultra long distance wireless transmission of low power wireless module
- 远程连接redis一会又断开重连
- Wake up wrist - neural network and deep learning (tensorflow application) updating
- 2022 safety officer-b certificate theoretical question bank and simulation test
- 2022 operation of simulation examination platform for safety officer C certificate
- Research Report on development trend and competitive strategy of global wafer recycling and OEM service industry
- 2022年安全员-A证考题模拟考试平台操作
- The remote connection to redis is disconnected and reconnected after a while
- CVPR 2022 | 元学习在图像回归任务的表现
- Data visualization platform based on template configuration
猜你喜欢

【Day9 文献泛读】On the (a)symmetry between the perception of time and space in large-scale environments

2022高压电工考试题模拟考试题库及在线模拟考试

RF中使用reuqests的两种方式

A method of relay for ultra long distance wireless transmission of low power wireless module

Discrete mathematics attention points, priority problems

Lekao.com: what is the difference between Level 3 health managers and level 2 health managers?

Teacher lihongyi, NTU -- tips for DNN regulation

16 | floating point numbers and fixed-point numbers (Part 2): what is the use of a deep understanding of floating-point numbers?

2022 safety officer-b certificate theoretical question bank and simulation test
![[Day8 literature extensive reading] space and time in the child's mind: evidence for a cross dimensional symmetry](/img/c2/e70e7c32c5dc5554dea29cb4627644.png)
[Day8 literature extensive reading] space and time in the child's mind: evidence for a cross dimensional symmetry
随机推荐
[day13-14 intensive literature reading] cross dimensional magnetic interactions arise from memory interference
栈(C语言)
【自然语言处理】【多模态】ALBEF:基于动量蒸馏的视觉语言表示学习
Wake up wrist - neural network and deep learning (tensorflow application) updating
Cloudcompare source code analysis: read ply file
JS common method collection
Analysis on the market prospect of smart home based on ZigBee protocol wireless module
小程序启动性能优化实践
【Day2 文献精读】Time in the mind: Using space to think about time
Summary of personal wrong questions (the wrong questions have not been solved and are used for help)
A new product with advanced product power, the new third generation Roewe rx5 blind subscription is opened
2022 online summit of emerging market brands going to sea will be held soon advance AI CEO Shou Dong will be invited to attend
2022年安全员-A证考题模拟考试平台操作
Data visualization platform based on template configuration
2022 high voltage electrician test question simulation test question bank and online simulation test
想做钢铁侠?听说很多大佬都是用它入门的
2022新兴市场品牌出海线上峰会即将举办 ADVANCE.AI CEO寿栋将受邀出席
Software installation and use, etc
Two way leading circular linked list (C language)
帝国理工等最新《胶囊网络综述》论文,29页pdf阐述胶囊的概念、方法与应用