x-www-form-urlencoded:

path = "/api/v1/topics/update"
params={'accesstoken':'d38a77f0-6f29-45cd-8d49-f72f15b98fd2','topic_id':'5c89021773798770589936b0','title':'hahaha','tab':'share','content':'hahaha'}
response_text = requests.post(url=self.url+path, data=params).text # 将响应内容转换成字典格式
response_dict = json.loads(response_text)
# 获取response message字段的值
response_message = response_dict['topic_id']
# 判断message的值
self.assertEqual(response_message, '5c89021773798770589936b0', msg='topic返回值不对')

form-data:

# post request method
response = requests.post(url=url + path, params=params,headers=headers)
# Is the return status code 200?
self.assertEqual(response.status_code, 200, msg="The status code is not 200")
# Is the return message SUCCESS?
response_text = requests.post(url=url + path, params=params,headers=headers).text
# Convert response content into dictionary format.
response_dict = json.loads(response_text)
# Gets the value of the response message.
response_message = response_dict['message']
# Determine the value of message.
self.assertEqual(response_message, 'SUCCESS', msg='The response message is not SUCCESS')
#Print response text.
print(response.text)

最新文章

  1. 《HeadFirst SQL》笔记
  2. SpringMVC自定义处理器里的那些事
  3. 7-RandomAccessFile 随机流
  4. CSS样式覆盖顺序
  5. scp: command not found如何解决
  6. iOS - (集成支付宝SDK大坑总结)
  7. iOS开发--控件
  8. MySQL中DATE_FORMATE函数内置字符集解析
  9. MYSQL基础笔记(一)
  10. ActiveMQ 的安装
  11. php上传图片到server
  12. Python-数据类型-转摘
  13. hdu 5591 BestCoder Round #65(博弈)
  14. 编译内核时出现drivers/mfd/mxc-hdmi-core.c:36:24: fatal error: mach/clock.h: No such file or directory
  15. HTTP与HTTPS对访问速度(性能)的影响
  16. 关于Select2下拉框组件
  17. Beta冲刺随笔汇总
  18. Node操作MongoDB并与express结合实现图书管理系统
  19. 事务的ACID性质
  20. SparkSQL简介

热门文章

  1. learn python the hard way 习题18~25总结
  2. 质控工具之TrimGalore使用方法
  3. Mac必备神器之Go2Shell
  4. JavaScript动态加载资源
  5. android -------- Data Binding的使用 RecyclerView
  6. android -------- 混淆打包报错(warning - InnerClass annotations are missing corresponding EnclosingMember annotations)
  7. Vue音乐项目笔记(四)(搜索页面提取重写)
  8. mac下 配置homebrew 和java home
  9. Parking Lot CodeForces - 480E
  10. JQ 实现监测input中值的变化并绑定到另个input