Hello,
When I call the function boto3.resource(...), if the "endpoint_url" parameter value contains an underscore, I got the following error :
ValueError: Invalid endpoint
I have to use this underscore because I use boto3 in a Gitlab-CI project and Gitlab-CI generates host names with underscores... why is the underscore forbidden here ?
Thanks a lot!
Code example :
import boto3
resource = boto3.resource(
service_name='s3',
aws_access_key_id='my_access_key',
aws_secret_access_key='my_secret_key',
endpoint_url='http://my_url_with_underscores'
)
Traceback :
Traceback (most recent call last):
File "<stdin>", line 5, in <module>
File "/tmp/virtual_env27/local/lib/python2.7/site-packages/boto3/__init__.py", line 87, in resource
return _get_default_session().resource(*args, **kwargs)
File "/tmp/virtual_env27/local/lib/python2.7/site-packages/boto3/session.py", line 371, in resource
aws_session_token=aws_session_token, config=config)
File "/tmp/virtual_env27/local/lib/python2.7/site-packages/boto3/session.py", line 250, in client
aws_session_token=aws_session_token, config=config)
File "/tmp/virtual_env27/local/lib/python2.7/site-packages/botocore/session.py", line 818, in create_client
client_config=config, api_version=api_version)
File "/tmp/virtual_env27/local/lib/python2.7/site-packages/botocore/client.py", line 69, in create_client
verify, credentials, scoped_config, client_config, endpoint_bridge)
File "/tmp/virtual_env27/local/lib/python2.7/site-packages/botocore/client.py", line 238, in _get_client_args
timeout=(new_config.connect_timeout, new_config.read_timeout))
File "/tmp/virtual_env27/local/lib/python2.7/site-packages/botocore/endpoint.py", line 240, in create_endpoint
raise ValueError("Invalid endpoint: %s" % endpoint_url)
ValueError: Invalid endpoint: http://my_url_with_underscores
Please refer to this discussion as to why we do not allow underscores: https://github.com/boto/botocore/pull/960
Let us know if that make sense to you.
Closing due to inactivity
Everybody using Docker-Compose is going to run into this. You are the only HTTP client out there that refuses those URLs. Please don't do insane, unusual sanity checks that no one else does, don't provide any additional safety and breaks actual code.
Has this issue been resolved? I can't access endpoint URL's with docker-compose container names. Is there a workaround? @remram44 ?
Most helpful comment
Everybody using Docker-Compose is going to run into this. You are the only HTTP client out there that refuses those URLs. Please don't do insane, unusual sanity checks that no one else does, don't provide any additional safety and breaks actual code.