poornas: @vadmeste, appveyor and travis are both failing.
vadmeste: Fixed @poornas 
diff --git a/minio/api.py b/minio/api.py
index cb7e207..3c29b3a 100644
--- a/minio/api.py
+++ b/minio/api.py
@@ -1605,7 +1605,12 @@ class Minio(object):
         is_non_empty_string(object_name)
         is_non_empty_string(upload_id)
 
-        data = xml_marshal_complete_multipart_upload(uploaded_parts)
+        # Order uploaded parts as required by S3 specification
+        ordered_parts = []
+        for part in sorted(uploaded_parts.keys()):
+            ordered_parts.append(uploaded_parts[part])
+
+        data = xml_marshal_complete_multipart_upload(ordered_parts)
         sha256_hex = get_sha256_hexdigest(data)
         md5_base64 = get_md5_base64digest(data)
 
diff --git a/minio/xml_marshal.py b/minio/xml_marshal.py
index e450d6b..9c62aa0 100644
--- a/minio/xml_marshal.py
+++ b/minio/xml_marshal.py
@@ -51,17 +51,17 @@ def xml_marshal_complete_multipart_upload(uploaded_parts):
     """
     Marshal's complete multipart upload request based on *uploaded_parts*.
 
-    :param uploaded_parts: List of all uploaded parts ordered in the
-           way they were uploaded.
+    :param uploaded_parts: List of all uploaded parts, ordered by part number.
     :return: Marshalled XML data.
     """
     root = s3_xml.Element('CompleteMultipartUpload', {'xmlns': _S3_NAMESPACE})
-    for part_number in uploaded_parts.keys():
+    for uploaded_part in uploaded_parts:
+        part_number = uploaded_part.part_number
         part = s3_xml.SubElement(root, 'Part')
         part_num = s3_xml.SubElement(part, 'PartNumber')
         part_num.text = str(part_number)
         etag = s3_xml.SubElement(part, 'ETag')
-        etag.text = '"' + uploaded_parts[part_number].etag + '"'
+        etag.text = '"' + uploaded_part.etag + '"'
         data = io.BytesIO()
         s3_xml.ElementTree(root).write(data, encoding=None,
                                        xml_declaration=False)

Part order error with fput_object
When trying to upload a 200MB file to minio server with minio-py I'm getting an error.

minio-py  version 2.2.5
minio server RELEASE.2017-09-29T19-16-56Z

```
File "/usr/local/lib/python3.6/dist-packages/minio/api.py", line 561, in fput_object
    content_type, metadata)
  File "/usr/local/lib/python3.6/dist-packages/minio/api.py", line 767, in put_object
    data, length, metadata=metadata)
  File "/usr/local/lib/python3.6/dist-packages/minio/api.py", line 1561, in _stream_put_object
    metadata=metadata)
  File "/usr/local/lib/python3.6/dist-packages/minio/api.py", line 1632, in _complete_multipart_upload
    content_sha256=sha256_hex)
  File "/usr/local/lib/python3.6/dist-packages/minio/api.py", line 1781, in _url_open
    object_name).get_exception()
minio.error.InvalidPartOrder: InvalidPartOrder: message: The list of parts was not in ascending order.Parts list must specified in order by part number.
```

Maybe related to this commit?
https://github.com/minio/minio-py/pull/563
diff --git a/tests/unit/generate_xml_test.py b/tests/unit/generate_xml_test.py
index 18706b9..bdd1dfd 100644
--- a/tests/unit/generate_xml_test.py
+++ b/tests/unit/generate_xml_test.py
@@ -33,17 +33,16 @@ class GenerateRequestTest(TestCase):
                           b'<Part><PartNumber>2</PartNumber><ETag>"0c78aef83f66abc1fa1e8477f296d394"</ETag>' \
                           b'</Part><Part><PartNumber>3</PartNumber><ETag>"acbd18db4cc2f85cedef654fccc4a4d8"' \
                           b'</ETag></Part></CompleteMultipartUpload>'
-        etags = {}
-        etags = {
-            1: UploadPart('bucket', 'object', 'upload_id', 1,
+        etags = [
+            UploadPart('bucket', 'object', 'upload_id', 1,
                             'a54357aff0632cce46d942af68356b38',
                             None, 0),
-            2: UploadPart('bucket', 'object', 'upload_id', 2,
+            UploadPart('bucket', 'object', 'upload_id', 2,
                             '0c78aef83f66abc1fa1e8477f296d394',
                             None, 0),
-            3: UploadPart('bucket', 'object', 'upload_id', 3,
+            UploadPart('bucket', 'object', 'upload_id', 3,
                             'acbd18db4cc2f85cedef654fccc4a4d8',
                             None, 0),
-        }
+        ]
         actual_string = xml_marshal_complete_multipart_upload(etags)
         eq_(expected_string, actual_string)

pip install -e .
parse_log_pytest
pytest
nose mock pytest
3.5
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
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@41240393e679226942d2300f281602468b20c7b2#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
pytz==2025.2
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:
      - mock==5.2.0
      - nose==1.3.7
      - pytz==2025.2
      - urllib3==1.26.20
prefix: /opt/conda/envs/minio-py

tests/unit/generate_xml_test.py::GenerateRequestTest::test_generate_complete_multipart_upload
tests/unit/generate_xml_test.py::GenerateRequestTest::test_generate_bucket_constraint
minio/xml_marshal.py minio/api.py
minio/xml_marshal.py minio/api.py