zoukankan      html  css  js  c++  java
  • python http post简单例子

    仅做post跟返回,一般作为接口测试数据请求以及返回数据是否正确,辅CPP

    #code=utf-8
    import requests
    import sys

    data = {'account': '12345678@qq.com', 'pass': 'llq', 'type': '0', 'level': '1'}
    token = "1249593182902824962:client:34a36980c093151b31874e9d2c28fe97"
    #head = {'token': token, 'Content-Type': 'application/json; charset=UTF-8'}
    head = {'Content-Type': 'application/json; charset=UTF-8'}

    loginId = "1275363433375326209"
    userName = ""
    password = ""
    loginData = {'account': userName, 'pass': password, 'type': '0', 'level': '1'}
    requestData = {'loginId': '1275384431030034433'}
    url = 'url = xxx'

    mainUrl = postUrl.loginUrl

    #url = postUrl.loginInfo + "?loginId=" + loginId
    print(mainUrl)
    #res = requests.post(url, params = requestData, headers= head)
    res = requests.post(mainUrl, params = data, headers= head)
    #res = requests.get(url, headers = head)

    response = res.json()
    print(response)

  • 相关阅读:
    P1030 求先序排列 P1305 新二叉树
    spfa
    Clairewd’s message ekmp
    Cyclic Nacklace hdu3746 kmp 最小循环节
    P1233 木棍加工 dp LIS
    P1052 过河 线性dp 路径压缩
    Best Reward 拓展kmp
    Period kmp
    Substrings kmp
    Count the string kmp
  • 原文地址:https://www.cnblogs.com/liuruoqian/p/14684700.html
Copyright © 2011-2022 走看看