carsonyl / pypac

Find and use proxy auto-config (PAC) files with Python and Requests.
https://pypac.readthedocs.io
Apache License 2.0
71 stars 19 forks source link

Pypac module is not working in Mac OS with cx_freeze #45

Closed shashanka3799 closed 3 years ago

shashanka3799 commented 5 years ago

I am creating PACSession from pypac module and calling request method from PACSession object it not giving any response back when I am creating excutable using cx_freeze module.Same code works fine from python console.

I tried debugging the inbuilt files then I came to know that there is some issue with this method autoconfig_url_from_preferences() in this line config=SystemConfiguration.SCDynamicStoreCopyProxies(None) which is in /pypac/os_settings.py . I tried it running as a subprocess it works fine but subprocess returns output as bytes or string but I want output as response object. Below is my code snippet:

try:
        from pypac import PACSession
        s = PACSession()
        get_logger().debug("Getting Internet details from PACSession")
        r = s.request('GET', url, None, stream=True, verify=self.get_verification_condition(event_data),
                  cookies=cookies)
    except requests.exceptions.ProxyError as e:
        get_logger().debug(e)
        get_logger().debug("proxy failed trying direct connection")

I expect the output as response object but actually it is not returning anything i.e, it does not show error or exception.

shashanka3799 commented 5 years ago

Do you have any solution for this issue? This is gentle reminder to look after this issue. This issue plays vital role in our project.Please look into it as soon as possible. Thanks, in advance.

carsonyl commented 5 years ago

MacOS isn't an environment I have access to, and cx_freeze isn't a tool I'm familiar with, so it's difficult for me to investigate this. PyPAC's use of Mac's SystemConfiguration was added by another contributor. Have you tried hacking up PyPAC to remove SystemConfiguration to see if it works?

shashanka3799 commented 5 years ago

Thanks, for your quick reply. I tried debugging pypac module to see where it is failing. It is failing in this line config=SystemConfiguration.SCDynamicStoreCopyProxies(None) . Do you have any idea to whom should I contact for PyPAC use of Mac System?

carsonyl commented 5 years ago

It may be up to you to solve this mystery. I don't know anyone else with your scenario. I think the first issue is why you describe a failure, but are also unable to get the error/exception with your code example.