源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

Python 使用requests模块发送GET和POST请求的实现代码

  • 时间:2022-12-25 21:56 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:Python 使用requests模块发送GET和POST请求的实现代码
①GET
# -*- coding:utf-8 -*-

import requests

def get(url, datas=None):
  response = requests.get(url, params=datas)
  json = response.json()
  return json
注:参数datas为json格式 ②POST
# -*- coding:utf-8 -*-

import requests

def post(url, datas=None):
  response = requests.post(url, data=datas)
  json = response.json()
  return json
注:参数datas为json格式
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部