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)