python系列之:python request实现http post请求curl -u 用户名:密码 url -X POST

python系列之:python request实现http post请求curl -u 用户名:密码 url -X POST

把curl -u 用户名:密码 url -X POST命令转为用python代码实现提交post请求:

  • curl -u debezium:optics123 http://debezium1:8083/connectors/mysql-optics-prod-connector/restart -X POST
import requests
s = requests.session()
s.auth = ('debezium', 'optics123')
restart_url = f"http://debezium1:8083/connectors/mysql-optics-prod-connector/restart"
s.post(restart_url)
上一篇:TreeMap 实现类


下一篇:mysql聚合函数 group by和order by等