# -*- coding: UTF-8 -*-
# 作者：zxm2015
# 标题：requests post 请求
# 描述：requests post 请求

import requests


def get_response(url, data, headers=None):
    response = requests.post(url, data, headers)
    return response.text


def test():
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.146 Safari/537.36"
    }
    data = {
        "key1": "value1",
        "key2": "value2"
    }
    url = "http://httpbin.org/post"
    html = get_response(url, data, headers)
    print(html)


if __name__ == '__main__':
    test()
