Skip to main content
Participant
August 2, 2023
Question

Got SSL error.

  • August 2, 2023
  • 5 replies
  • 2502 views

Can\'t connect to HTTPS URL because the SSL module is not available.". This is the erros I got when I try to run python src/extractpdf/extract_txt_from_pdf.py on pycharm

    5 replies

    Participant
    September 10, 2025

    The ssl error that is getting and the most common SSL errors that can be occured are as follows:-

     

    1) SSL Certificate not trusted error

    2) Expired SSL Certificate

    3) Mixed Content warnings

    4) SSL Protocol or Cipher mismatch

    5) Improperly configured certificate chain

    6) Name mismatch error

    7) Self signed certificate error

    😎 Untrusted root certificate 

    9) Certificate revoked error

    10) SSL Certificate yet not valid

    To solve the error issue solution in detail, you can find the following guide at:-  https://cheapsslweb.com/blog/troubleshooting-most-common-ssl-errors/. Maybe it will be helpful.

    Participant
    January 17, 2024

    This error occurs due to various reasons, but it mostly happens when your SSL module is not properly configured in your python envoronment.

    Here is some steps to solve this issues:

    1) First of all you can check the python version
    2) Need to update the python
    3) Check you SSL Module availability:- You can do this by opening a Python shell and typing:

    import ssl
    print(ssl.OPENSSL_VERSION)

    If the issuses are importing "SSl Module", then it indicate a problem with your Python installation.
    4) Reinstall Python
    5) Check PyCharm Interpreter
    6) Virtual Environment:
    7) Install SSL Libraries:
    😎 Check your Network Configuration:
    9) Check your proxy settings in PyCharm
    10) SSL/TLS Certificate Issues

    Participant
    January 17, 2024

    This error occurs due to various reasons, but it mostly happens when your SSL module is not properly configured in your python envoronment.

    Here is some steps to solve this issues:

    1) First of all you can check the python version
    2) Need to update the python
    3) Check you SSL Module availability:- You can do this by opening a Python shell and typing:

    import ssl
    print(ssl.OPENSSL_VERSION)

    If the issuses are importing "SSl Module", then it indicate a problem with your Python installation.
    4) Reinstall Python
    5) Check PyCharm Interpreter
    6) Virtual Environment:
    7) Install SSL Libraries:
    😎 Check your Network Configuration:
    9) Check your proxy settings in PyCharm
    10) SSL/TLS Certificate Issues

    To Know more about this issue so, check this blog:-  https://www.ssl2buy.com/wiki/ssl-tls-security-errors

    Participant
    August 3, 2023

    Hi Raymon, thanks for responding. So I guess not always I get this error, as I did make API request for various other services on behalf of accenture.
    Let me walk you through woth what I did so far, maybe you can figure out if I did any blunder somewhere.

    Objective - To do the pdf table extaction (and text also when needed)

    Python version: Python 3.9.0
    Step 1: I downloaded a folder "pdfservices-python-sdk-samples" which has my crdentials in .json and all the other files and folders. Pic attached.
    Step 2: I created a new environment "adobe_test" and did installed the requirements.txt 

    Step 3: Opened anaconda cmd and changed to my directory and environment
    Step 4:  set the credential id and credential secrets:

    SET PDF_SERVICES_CLIENT_ID="********************************"

    SET PDF_SERVICES_CLIENT_SECRET="*******************************"

     

    Step 5: I tried to run the py file on anaconda cmd: (adobe_test) C:\Users\anuvrat.a.shukla\pdfservices-python-sdk-samples>python C:\Users\anuvrat.a.shukla\pdfservices-python-sdk-samples\src\extractpdf\extract_txt_from_pdf.py
    Result:
    INFO:adobe.pdfservices.operation.pdfops.extract_pdf_operation:All validations successfully done. Beginning ExtractPDF operation execution

    Error:

    ERROR:root:Exception encountered while executing operation
    Traceback (most recent call last):
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\urllib3\connectionpool.py", line 714, in urlopen
    httplib_response = self._make_request(
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\urllib3\connectionpool.py", line 403, in _make_request
    self._validate_conn(conn)
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\urllib3\connectionpool.py", line 1053, in _validate_conn
    conn.connect()
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\urllib3\connection.py", line 419, in connect
    self.sock = ssl_wrap_socket(
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\urllib3\util\ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\urllib3\util\ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\ssl.py", line 1040, in _create
    self.do_handshake()
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
    ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1122)

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\requests\adapters.py", line 486, in send
    resp = conn.urlopen(
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\urllib3\connectionpool.py", line 798, in urlopen
    retries = retries.increment(
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\urllib3\util\retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
    urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='pdf-services.adobe.io', port=443): Max retries exceeded with url: /token (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1122)')))

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\adobe\pdfservices\operation\internal\http\http_client.py", line 61, in _execute_request
    response = requests.post(url=http_request.url,
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\requests\api.py", line 115, in post
    return request("post", url, data=data, json=json, **kwargs)
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\requests\api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\requests\sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\requests\sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\requests\adapters.py", line 517, in send
    raise SSLError(e, request=request)
    requests.exceptions.SSLError: HTTPSConnectionPool(host='pdf-services.adobe.io', port=443): Max retries exceeded with url: /token (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1122)')))

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\adobe\pdfservices\operation\internal\auth\service_principal_authenticator.py", line 68, in refresh_token
    response = http_client.process_request(http_request=http_request, success_status_codes=[HTTPStatus.OK],
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\adobe\pdfservices\operation\internal\http\http_client.py", line 37, in process_request
    response = _execute_request(http_request)
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\adobe\pdfservices\operation\internal\http\http_client.py", line 81, in _execute_request
    raise SdkException("Request could not be completed. Possible cause attached!", sys.exc_info())
    adobe.pdfservices.operation.exception.exceptions.SdkException: description =Request could not be completed. Possible cause attached!, requestTrackingId=(<class 'requests.exceptions.SSLError'>, SSLError(MaxRetryError("HTTPSConnectionPool(host='pdf-services.adobe.io', port=443): Max retries exceeded with url: /token (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1122)')))")), <traceback object at 0x000002DCC07884C0>)

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "C:\Users\anuvrat.a.shukla\pdfservices-python-sdk-samples\src\extractpdf\extract_txt_from_pdf.py", line 49, in <module>
    result: FileRef = extract_pdf_operation.execute(execution_context)
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\adobe\pdfservices\operation\pdfops\extract_pdf_operation.py", line 153, in execute
    raise ex
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\adobe\pdfservices\operation\pdfops\extract_pdf_operation.py", line 141, in execute
    download_uri = ExtractPDFService.extract_pdf(execution_context, self._source_file_ref, self.get_options(),
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\adobe\pdfservices\operation\internal\service\extract_pdf_service.py", line 44, in extract_pdf
    raise e
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\adobe\pdfservices\operation\internal\service\extract_pdf_service.py", line 29, in extract_pdf
    get_upload_uri_response = StorageApi.get_upload_uri(context, source_file_ref.get_media_type(), x_request_id)
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\adobe\pdfservices\operation\internal\api\storage_api.py", line 72, in get_upload_uri
    response = http_client.process_request(http_request=http_request,
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\adobe\pdfservices\operation\internal\http\http_client.py", line 31, in process_request
    access_token = http_request.authenticator.session_token().access_token
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\adobe\pdfservices\operation\internal\auth\service_principal_authenticator.py", line 49, in session_token
    return self.refresh_token()
    File "C:\Users\anuvrat.a.shukla\Anaconda3\envs\adobe_test\lib\site-packages\adobe\pdfservices\operation\internal\auth\service_principal_authenticator.py", line 74, in refresh_token
    raise SdkException("Exception in fetching access token", sys.exc_info())
    adobe.pdfservices.operation.exception.exceptions.SdkException: description =Exception in fetching access token, requestTrackingId=(<class 'adobe.pdfservices.operation.exception.exceptions.SdkException'>, SdkException('Request could not be completed. Possible cause attached!', (<class 'requests.exceptions.SSLError'>, SSLError(MaxRetryError("HTTPSConnectionPool(host='pdf-services.adobe.io', port=443): Max retries exceeded with url: /token (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1122)')))")), <traceback object at 0x000002DCC07884C0>)), <traceback object at 0x000002DCC0794500>)



    Question 1:I wonder where is the input/sample pdf placed in the directory? Or should I have to place my pdf somewhere? I'm confused.

    Question 2: How to resolve this error? Is this becasue of some SSL certificate error? What can be done?

    I want to use my free trial on couple of PDFs . I think Adobe's this service is good in extracting tables, and hence want to convince my senior managment to procure the license . But first I need to set this up on and show th results. Kindly help.

    Best, 

    Anuvrat

     

    Raymond Camden
    Community Manager
    Community Manager
    August 3, 2023

    The source is in the resources folder you should have in your download. If you don't see that, maybe copy from the zip again?

     

    Also, if you (in a different Python file), make a request to https://pdf-services-ue1.adobe.io/token, does it fail? I mean it will fail due to not sending the right stuff, but I mean the SSL fail. 

    Participant
    August 4, 2023

    Quick update: I'm able to run the sample program on Google colab. (I uploaded the entire projectgoogle drive, and mounted drive on google colab). 

    So there is no SSL Certificate error on colab, but throws SSL Certificate error when I run the project on my local machine (jupyter notebook or pycharm or anaconda prompt). WHy would that happen? Eventually I have to take thi on local machine only. Any idea what should I do to remove SSL Certificate error . I have already pasted the entire error in this thread above.

    Best,

    Anuvrat

    Raymond Camden
    Community Manager
    Community Manager
    August 2, 2023

    Hmm, if you do a Python request to _any_ HTTPS site, do you get the same?