How to reslove "Failed to create connection to S3 bucket" error

I have been able to use this code to read files in media set in code repository in the public foundry:

with control_file_input.get_media_item(item.mediaItemRid) as stream:

                xml_bytes = stream.read()

In recent several days, the code will generate error message at the 2nd line: Failed to create connection to host host='pcloud-mio-REDACTED.s3.us-east-1.amazonaws.com', port=443

Can I adjust my settings in some way to solve this error?

Have you tried passing use_signed_url=False to read through Foundry’s media service instead of downloading directly using a signed URL?

with control_file_input.get_media_item(
    item.mediaItemRid, use_signed_url=False
) as stream:
    xml_bytes = stream.read()

This really solved the issue. The original code without ‘use_signed_url=False’ had been working fine but suddenly failed a week ago. The sudden changes of the defaults of infrastructure happen quite often. It is really a headache in my testing. Thanks again!