python-radosgw-admin
python-radosgw-admin copied to clipboard
Proxy connection failing.
Hi!
I need to send requests for rados gateway behind a http proxy and I'm applying the following settings on my connector:
# -*- coding: utf-8 -*-
#!/usr/bin/env python3
from radosgw.connection import RadosGWAdminConnection
rgwadmin = RadosGWAdminConnection(host="rados_gateway_server",
access_key="ACCESS_KEY",
secret_key="SECRET_KEY",
proxy="http_proxy_server",
proxy_port=3128,
proxy_user="http_proxy_user",
proxy_pass="http_proxy_pass",
debug=True)
users = rgwadmin.get_users()
for u in users:
print(f"Username: {u.display_name}")
print(f"User ID: {u.user_id}")
I'm getting the error bellow:
2020-10-22 17:00:53,855 boto [DEBUG]:http_request:method:(GET) protocol:(https) host(rados_gateway) port(443) path(https://rados_gateway/admin/metadata/user?format=json) params({'format': 'json'}) headers({}) body()
2020-10-22 17:00:53,855 boto [DEBUG]:Method: GET
2020-10-22 17:00:53,856 boto [DEBUG]:Path: https://rados_gateway/admin/metadata/user?format=json
2020-10-22 17:00:53,856 boto [DEBUG]:Data:
2020-10-22 17:00:53,856 boto [DEBUG]:Headers: {}
2020-10-22 17:00:53,856 boto [DEBUG]:Host: rados_gateway
2020-10-22 17:00:53,856 boto [DEBUG]:Port: 443
2020-10-22 17:00:53,856 boto [DEBUG]:Params: {'format': 'json'}
2020-10-22 17:00:53,856 boto [DEBUG]:establishing HTTPS connection: host=rados_gateway, kwargs={'timeout': 30, 'port': 443}
2020-10-22 17:00:53,860 boto [DEBUG]:Proxy connection: CONNECT rados_gateway:443 HTTP/1.0
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/python/venv/lib/python3.7/site-packages/radosgw/connection.py", line 162, in get_users
response = self.make_request('GET', path='/metadata/user', query_params=params)
File "/opt/python/venv/lib/python3.7/site-packages/radosgw/connection.py", line 120, in make_request
retry_handler=retry_handler)
File "/opt/python/venv/lib/python3.7/site-packages/boto/connection.py", line 913, in _mexe
self.is_secure)
File "/opt/python/venv/lib/python3.7/site-packages/boto/connection.py", line 705, in get_http_connection
return self.new_http_connection(host, port, is_secure)
File "/opt/python/venv/lib/python3.7/site-packages/boto/connection.py", line 747, in new_http_connection
connection = self.proxy_ssl(host, is_secure and 443 or 80)
File "/opt/python/venv/lib/python3.7/site-packages/boto/connection.py", line 796, in proxy_ssl
sock.sendall("CONNECT %s HTTP/1.0\r\n" % host)
TypeError: a bytes-like object is required, not 'str'
What's gone wrong? Can you help me?
Tks!