当前位置:网站首页>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()}
边栏推荐
- [day1/5 literature intensive reading] speed constancy or only slowness: what drives the kappa effect
- 2022年安全员-A证考题模拟考试平台操作
- GMN of AI medicine article interpretation
- [Day8 literature extensive reading] space and time in the child's mind: evidence for a cross dimensional symmetry
- Si4432 RF chip scheme typical application of data transmission of wireless communication module of Internet of things
- CVPR 2022 | meta learning performance in image regression task
- IEEE754标准中的4种舍入模式
- Review C language I
- Method for WiFi wireless transmission module to access cloud platform using esp8266 chip scheme
- [Delphi] determine the encoding method of the file (ANSI, Unicode, utf8, unicodebig)
猜你喜欢
![[day15 literature extensive reading] numerical magnetic effects temporary memories but not time encoding](/img/57/9ce851636b927813a55faedb4ecd48.png)
[day15 literature extensive reading] numerical magnetic effects temporary memories but not time encoding

2022 safety officer-a certificate test question simulation test platform operation
![[day3 literature intensive reading] Oriental time and space interaction in tau and kappa effects](/img/90/4470dca9b19dbcd0f99655f7d9d23e.png)
[day3 literature intensive reading] Oriental time and space interaction in tau and kappa effects

Only three steps are needed to learn how to use low code thingjs to connect with Sen data Dix data
![[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

How to do investment analysis in the real estate industry? This article tells you

2022年安全员-B证理论题库及模拟考试

volatile的解构| 社区征文

Here we go! Dragon lizard community enters PKU classroom

The latest "capsule Network Overview" paper of imperial technology, etc., 29 pages of PDF, expounds the concept, method and application of capsule
随机推荐
Figure overview of neural network
2022 safety officer-a certificate test question simulation test platform operation
Here we go! Dragon lizard community enters PKU classroom
Recruitment of audio and video quality test and Development Engineer
Unity3d C#开发微信小游戏音频/音效播放问题解决过程分享
IEEE754标准中的4种舍入模式
我的创作纪念日
Analysis on the market prospect of smart home based on ZigBee protocol wireless module
机器学习之数据处理与可视化【鸢尾花数据分类|特征属性比较】
2022年起重机司机(限桥式起重机)考试题模拟考试题库及模拟考试
JsonParseException: Unrecognized token ‘username‘: was expecting表单提交登陆数据报错
Toyota suppliers shut down Japanese factories due to cyber attacks, NVIDIA counterattacks extortion gangs to prevent data leakage | global cyber security hotspot on March 1
The second bullet of in-depth dialogue with the container service ack distribution: how to build a hybrid cloud unified network plane with the help of hybridnet
Two way leading circular linked list (C language)
CloudCompare源码分析:读取ply文件
遇到表格,手动翻页太麻烦?我教你写脚本,一页展示所有数据
Software installation and use, etc
16 | floating point numbers and fixed-point numbers (Part 2): what is the use of a deep understanding of floating-point numbers?
postgresql10 进程
Method for debugging wireless data packet capturing of Internet of things zigbee3.0 protocol e18-2g4u04b module