I found a workaround for this issue but am posting it to document the resolution and in case the need for the workaround can be addressed.
Issue Description:
I am uploading files to an existing SB item. For smaller files I'm using upload_file_to_item and that works as expected. For larger files I am using upload_cloud_file_to_item and then I am getting an SSL error:
SSLError: HTTPSConnectionPool(host='api.sciencebase.gov', port=443): Max retries exceeded with url: /graphql (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1016)')))
-
I am currently in the office on the wired network
-
I have confirmed that I am logged into SB
-
I tried explicitly pointing to the SSL certificate I have but that didn't fix it.
url = "https://api.sciencebase.gov/"
cert_path = r'...\<cert_file.pem>'
response = requests.get(url, verify=cert_path)
-
When I disconnected from the wired network and connected to the internal wifi the file uploaded but then returned an unauthorized access exception
ret = sb.upload_cloud_file_to_item(sb_id, thisFile)
Uploading |################################| 12/12
File ~\SbSession.py:1294, in SbSession._check_errors(self, response)
1292 raise Exception("Resource not found, or user does not have access")
1293 elif response.status_code == 401:
-> 1294 raise Exception("Unauthorized access")
1295 elif response.status_code == 429:
1296 raise Exception("Too many requests")
Exception: Unauthorized access
Issue Resolution:
- Finally when I connected to the visitor wifi (still connected to GlobalProtect) the file uploaded as expected
I found a workaround for this issue but am posting it to document the resolution and in case the need for the workaround can be addressed.
Issue Description:
I am uploading files to an existing SB item. For smaller files I'm using
upload_file_to_itemand that works as expected. For larger files I am usingupload_cloud_file_to_itemand then I am getting an SSL error:I am currently in the office on the wired network
I have confirmed that I am logged into SB
I tried explicitly pointing to the SSL certificate I have but that didn't fix it.
url = "https://api.sciencebase.gov/"cert_path = r'...\<cert_file.pem>'response = requests.get(url, verify=cert_path)When I disconnected from the wired network and connected to the internal wifi the file uploaded but then returned an unauthorized access exception
Issue Resolution: