An error occurred during the upload a file to SauceLabs
:
Exception: During uploading the App file an exception occurred: HTTPSConnectionPool(host='api.us-west-1.saucelabs.com', port=443): Max retries exceeded with url: /v1/storage/upload (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:2393)')))
This is the code I use for uploading files to SauceLabs
:
def uploadApp(self, file_path: str, file_name: str, description: str = None) -> str:
"""
Uploads an app file to Sauce Storage for the purpose of mobile app testing.
Sauce Storage supports app files in *.apk, *.aab, *.ipa, or *.zip format, up to 4GB.
Args:
- app_path (str): The local path to the app file you want to upload. For example: '/path/to/the/folder/'
- app_file_name (str): The name of the app file, including the file type extension.
- description (str): An optional description for the app.
Returns:
- The ID of the uploaded app.
Raises:
- Exception: If an error occurs while uploading the app file.
"""
if not file_path.endswith(os.path.sep):
file_path = file_path + os.path.sep
app_file = os.path.join(file_path, file_name)
form_data = {
"payload": (app_file, open(app_file, "rb")),
"name": file_name,
"description": description
}
try:
response = requests.post('https://api.us-west-1.saucelabs.com/v1/storage/upload',
auth=(self.username, self.access_key),
files=form_data, timeout=200, verify=False)
file_id = response.json().get('item', {}).get('id')
return file_id
except Exception as ex:
msg = f'During uploading the App file an exception occurred: {ex}'
raise Exception(msg)
I have already tried many different variations of the code, but nothing helps. I would be very grateful for any tips you could provide!