Open MikhailNaumenko opened 3 months ago
did you already try the following?
garth.configure(proxies={"https": "https://myproxy"})
Yes, sure. Without doing this the the valuable "parent: Optional[Session] = None" will not have any info about proxy or certificate check. So it is mandatory. You can try it yourself.
req = Request( method=method.upper(), url=url, headers=headers, files=files, data=data or {}, json=json, params=params or {}, auth=auth, cookies=cookies, hooks=hooks, ) prep = self.prepare_request(req)
proxies = proxies or {}
But if you modify your code like I said before (OAUTH_CONSUMER = requests.get(OAUTH_CONSUMER_URL, proxies=parent.proxies, verify=parent.verify).json()), the proxies will contains a dictionary with your proxy settings.
Interesting ... I'll try to reproduce and make the change. I'll get to it this weekend.
Hello! First of all I would like to say thank you for you package! It's very usefull for me! Great job. I use it from my working place and my organization uses proxy to connect users to the internet. I was unable to connect. The reason was in sso.py module. It will not pass any http.Client configuration during requests.get(OAUTH_CONSUMER_URL).json(). So I modified this part of code to this: OAUTH_CONSUMER = requests.get(OAUTH_CONSUMER_URL, proxies=parent.proxies, verify=parent.verify).json() Everything works for me now. Maybe it could be the case for other users behind a proxy.
class GarminOAuth1Session(OAuth1Session): def init( self, /, parent: Optional[Session] = None, kwargs, ): global OAUTH_CONSUMER if not OAUTH_CONSUMER: OAUTH_CONSUMER = requests.get(OAUTH_CONSUMER_URL).json() super().init( OAUTH_CONSUMER["consumer_key"], OAUTH_CONSUMER["consumer_secret"], kwargs, ) if parent is not None: self.mount("https://", parent.adapters["https://"]) self.proxies = parent.proxies self.verify = parent.verify