统信yum地址 https://euler-packages.chinauos.com/server-euler/fuyu/1060/everything/sw_64/Packages/
浏览器访问401报错无权限,查看linux uos环境下yum配置的用户名和密码
cat /etc/yum/vars/auth_*
然后自己组装生成Basic Authorization
def generate_basic_auth_header(username, password):
# 将用户名和密码组合为 "username:password"
credentials = f"{username}:{password}"
# 编码为 Base64
encoded_credentials = base64.b64encode(credentials.encode()).decode()
# 生成 Authorization 头
auth_header = f"Basic {encoded_credentials}"
return auth_header
generate_basic_auth_header("usernname", "password")
生成的字符串格式为下面这样
Basic dW9zLWh0dHBzOi8vbGljZW5zZS5jaGluYXVvcy5jb20tYXB0OmE9V0VZUlNGUzNCRzdIREFBQSZhYT0mYWI9djEmYWc9VU5LTk9XOjQ2Y2M4N2Q4ZTVlOWQ3Njc3NWNjNjZkZTUxZmQzYmExJmFoPTZDQjMxMTY1NEZGMCw2Q0IzMTE2NTRGRjImYWo9MiZhaz0wMEJGRkJCNjM1RjRCRERDQjI5NDM4MkUxQUI0MDE4QjIzRDhFOTcyMjZBRUE5NTUwNzBCRkE5MDdEQzYzRTJGRUI2QUE1NDgzMjgyODExREE0MDIyODY3MDdFOTQ2Njk5MTFCREFCQzJEMkUxQUU3MjAxOURDNDdCMDcxJmFsPTAxMDBGMTFFQzE2M0Q2MkQ0N0I0OTU4QjI5NTNCRDlGMDYyNzAwMDAwMDAwMDAwMDAwMDA0NEVCMkNEQkE1OUY0M0YyREIxMDc0QT**************************************
chrome浏览器安装插件ModHeader
进行以下配置,即可访问成功