2024-05-13 05:10:54 发布
网友
我正试图发送请求.post在Python中
username = "devoops123@mdf.nct.com" password = "ChangemeinNv!"
我的剧本有
我在执行脚本时遇到了401 Authentication问题
401 Authentication
在将密码作为参数传递给脚本时,我尝试了以下方法,但似乎没有任何帮助:
%21
!
@
\
" "
Jenkins希望您使用HTTP的Basic authentication特性发送用户名和密码。requests可以handle this natively。参见Jenkins Remove access API documentation:
requests
When your Jenkins is secured, you can use HTTP BASIC authentication to authenticate remote API requests.
只需将用户名和密码放入作为auth参数传入的元组中:
auth
start_build_url = 'http://{0}/jenkins/job/{1}/job/{2}/buildWithParameters?token={3}&{4}'.format( jenkins_uri, folder_name, job_name, build_token, build_param) r = requests.post( start_build_url, auth=(username, password), )
无论是username还是{}值都不需要转义,让{}替您操心。在
username
Jenkins希望您使用HTTP的Basic authentication特性发送用户名和密码。
requests
可以handle this natively。参见Jenkins Remove access API documentation:只需将用户名和密码放入作为
auth
参数传入的元组中:无论是}值都不需要转义,让{}替您操心。在
username
还是{相关问题 更多 >
编程相关推荐