Skip to content

Add SSL Certificate for examples.get_path() #862

@belletva

Description

@belletva

Currently, xDEM does not support adding an SSL context for urllib.request.urlopen calls, which is required in some cases to authenticate with the server. When trying to fetch data using xdem.examples.get_path, the function fails because it does not support adding an SSL context. The error occurs because the server requires a valid SSL certificate for authentication.

The xdem.examples.get_path function should support adding an SSL context to urllib.request.urlopen calls. This would allow users to provide a certificate file path (cafile) to validate the connection.

def get_path(self, example_name, cafile=None):
 ....
 if cafile:
        context = ssl.create_default_context(cafile=cafile)
        response = urllib.request.urlopen(url, context=context)
    else:
        response = urllib.request.urlopen(url)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementFeature improvement or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions