Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy connection failing. #31

Open
vsadriano opened this issue Oct 22, 2020 · 0 comments
Open

Proxy connection failing. #31

vsadriano opened this issue Oct 22, 2020 · 0 comments

Comments

@vsadriano
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant