Siddharthk commented on issue #9118:
URL: https://github.com/apache/airflow/issues/9118#issuecomment-664914574


   @ashb @JPonte I am getting below error. Looks like a bug:
   
   ```
   >>> from airflow.configuration import conf
   >>> from airflow.hooks.S3_hook import S3Hook
   >>> h = S3Hook(aws_conn_id=conf.get('core', 'remote_log_conn_id'))
   >>> c = h.get_conn()
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File 
"/home/airflow/.local/lib/python3.6/site-packages/airflow/hooks/S3_hook.py", 
line 44, in get_conn
       return self.get_client_type('s3')
     File 
"/home/airflow/.local/lib/python3.6/site-packages/airflow/contrib/hooks/aws_hook.py",
 line 176, in get_client_type
       session, endpoint_url = self._get_credentials(region_name)
     File 
"/home/airflow/.local/lib/python3.6/site-packages/airflow/contrib/hooks/aws_hook.py",
 line 102, in _get_credentials
       connection_object = self.get_connection(self.aws_conn_id)
     File 
"/home/airflow/.local/lib/python3.6/site-packages/airflow/hooks/base_hook.py", 
line 84, in get_connection
       conn = random.choice(list(cls.get_connections(conn_id)))
     File 
"/home/airflow/.local/lib/python3.6/site-packages/airflow/hooks/base_hook.py", 
line 80, in get_connections
       return secrets.get_connections(conn_id)
     File 
"/home/airflow/.local/lib/python3.6/site-packages/airflow/secrets/__init__.py", 
line 52, in get_connections
       conn_list = secrets_backend.get_connections(conn_id=conn_id)
     File 
"/home/airflow/.local/lib/python3.6/site-packages/airflow/secrets/base_secrets.py",
 line 69, in get_connections
       conn = Connection(conn_id=conn_id, uri=conn_uri)
     File "<string>", line 4, in __init__
     File 
"/home/airflow/.local/lib/python3.6/site-packages/sqlalchemy/orm/state.py", 
line 433, in _initialize_instance
       manager.dispatch.init_failure(self, args, kwargs)
     File 
"/home/airflow/.local/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py",
 line 69, in __exit__
       exc_value, with_traceback=exc_tb,
     File 
"/home/airflow/.local/lib/python3.6/site-packages/sqlalchemy/util/compat.py", 
line 178, in raise_
       raise exception
     File 
"/home/airflow/.local/lib/python3.6/site-packages/sqlalchemy/orm/state.py", 
line 430, in _initialize_instance
       return manager.original_init(*mixed[1:], **kwargs)
     File 
"/home/airflow/.local/lib/python3.6/site-packages/airflow/models/connection.py",
 line 119, in __init__
       self.parse_from_uri(uri)
     File 
"/home/airflow/.local/lib/python3.6/site-packages/airflow/models/connection.py",
 line 144, in parse_from_uri
       self.port = uri_parts.port
     File "/usr/local/lib/python3.6/urllib/parse.py", line 169, in port
       port = int(port, 10)
   ValueError: invalid literal for int() with base 10: 'abcd12'
   ```
   My aws secret key is(dummy): abcd12/ef34578fgt
   
   Looks like when '/' is coming in the secret key, the connection is not 
getting created. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to