Skip to content

Proxy support only partially implemented #76

@TimothyVermeirenBiztory

Description

The documentation refers to the use of HelperMethods.proxy_experimental to enable the use of a proxy server for e.g. license activation. The premise is the following:

  • Set HelperMethods.proxy_experimental = True in your own code.
  • The send_request method in internal.py checks whether the variable is set, and if so, "enables the proxy".

The second point specifically is implemented here. Except... it is only partially implemented, it seems.

When we check that section of the code, we find that the request is properly prepared with req.set_proxy(proxies['http'], 'http') etc. However, the line where the request is effectively sent (return urllib.request.urlopen...) can never be reached with a proxy set, because it is part of the other branch of the if statement for if HelperMethods.proxy_experimental == True:!

In other words, you can either set the proxy and not send the request, or not set the proxy and then send the request. Supposedly removing the else: clause/line and unindenting the line below with return urllib.request.urlopen... could work?

That would mean the full snippet (line 162 to 173) becomes:

            if HelperMethods.proxy_experimental == True:
                proxies = urllib.request.getproxies()
                if proxies != {}:
                    
                    if 'http' in proxies:
                        req.set_proxy(proxies['http'], 'http')
                    
                    if 'https' in proxies:
                        req.set_proxy(proxies['https'], 'https')
                    
            return urllib.request.urlopen(req).read().decode("utf-8")    

Not sure if that makes sense? I am no developer but happy to e.g. open a pull request and do whatever is necessary to suggest and test this fix, but I have no experience with that procedure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions