kannappanr: @Praveenrajmani Please fix the Appveyor build failures
Praveenrajmani: looks like an installation failure. will push again @kannappanr 
kannappanr: ping @nitisht 
diff --git a/appveyor.yml b/appveyor.yml
index f6ac53e..c301941 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -7,7 +7,7 @@ environment:
 
 install:
   # We need wheel installed to build wheels
-  - "%PYTHON%\\python.exe -m pip install wheel faker nose"
+  - "%PYTHON%\\python.exe -m pip install wheel faker nose mock"
   - "%PYTHON%\\python.exe setup.py install"
 
 build: off
diff --git a/minio/helpers.py b/minio/helpers.py
index 69881c7..9151b93 100644
--- a/minio/helpers.py
+++ b/minio/helpers.py
@@ -53,7 +53,7 @@ DEFAULT_PART_SIZE = MIN_PART_SIZE # Currently its 5MiB
 
 _VALID_BUCKETNAME_REGEX = re.compile('^[a-z0-9][a-z0-9\\.\\-]+[a-z0-9]$')
 _ALLOWED_HOSTNAME_REGEX = re.compile(
-    '^((?!-)[A-Z\\d-]{1,63}(?<!-)\\.)*((?!-)[A-Z\\d-]{1,63}(?<!-))$',
+    '^((?!-)(?!_)[A-Z\_\\d-]{1,63}(?<!-)(?<!_)\\.)*((?!_)(?!-)[A-Z\_\\d-]{1,63}(?<!-)(?<!_))$',
     re.IGNORECASE)
 
 _EXTRACT_REGION_REGEX = re.compile('s3[.-]?(.+?).amazonaws.com')

Minio rejects valid hostnames
The Minio python library rejects hostnames with underscores in them. Since this is a standard separator for docker container names, this causes problems when trying to run Minio as part of a docker compose setup.

For example, with a linked container named `minio_server`, this python session should not raise an error:
```
Python 3.6.8 (default, Mar 27 2019, 08:53:45) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from minio import Minio
>>> Minio('minio_server:9000')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/minio/api.py", line 147, in __init__
    is_valid_endpoint(endpoint)
  File "/usr/local/lib/python3.6/site-packages/minio/helpers.py", line 299, in is_valid_endpoint
    raise InvalidEndpointError('Hostname does not meet URL standards.')
minio.error.InvalidEndpointError: InvalidEndpointError: message: Hostname does not meet URL standards.
```
diff --git a/tests/unit/get_s3_endpoint_test.py b/tests/unit/get_s3_endpoint_test.py
index 7d3c943..ce536c3 100644
--- a/tests/unit/get_s3_endpoint_test.py
+++ b/tests/unit/get_s3_endpoint_test.py
@@ -27,3 +27,6 @@ class GetS3Endpoint(TestCase):
     def test_is_valid_endpoint(self):
         eq_(True, is_valid_endpoint('s3.amazonaws.com'))
         eq_(True, is_valid_endpoint('s3.cn-north-1.amazonaws.com.cn'))
+        eq_(True, is_valid_endpoint('minio_server:9000'))
+        eq_(True, is_valid_endpoint('s3.server_1.amazonaws.com'))
+        

pip install -e .[dev]
parse_log_pytest
pytest
nose mock Faker pytest
apt-get update apt-get install -y gcc
3.6
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
Faker==14.2.1
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
-e git+https://github.com/minio/minio-py.git@3efe9e9286d61e60ad69cd5e1aa0657b219b396c#egg=minio
mock==5.2.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
nose==1.3.7
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
python-dateutil==2.9.0.post0
pytz==2025.2
six==1.17.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
urllib3==1.26.20
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work

name: minio-py
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - attrs=21.4.0=pyhd3eb1b0_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - importlib-metadata=4.8.1=py36h06a4308_0
  - importlib_metadata=4.8.1=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - more-itertools=8.12.0=pyhd3eb1b0_0
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=21.3=pyhd3eb1b0_0
  - pip=21.2.2=py36h06a4308_0
  - pluggy=0.13.1=py36h06a4308_0
  - py=1.11.0=pyhd3eb1b0_0
  - pyparsing=3.0.4=pyhd3eb1b0_0
  - pytest=6.2.4=py36h06a4308_2
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - toml=0.10.2=pyhd3eb1b0_0
  - typing_extensions=4.1.1=pyh06a4308_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.6.0=pyhd3eb1b0_0
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - faker==14.2.1
      - mock==5.2.0
      - nose==1.3.7
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - six==1.17.0
      - urllib3==1.26.20
prefix: /opt/conda/envs/minio-py

tests/unit/get_s3_endpoint_test.py::GetS3Endpoint::test_is_valid_endpoint
tests/unit/get_s3_endpoint_test.py::GetS3Endpoint::test_get_s3_endpoint
appveyor.yml minio/helpers.py
appveyor.yml minio/helpers.py