liiight/notifiers

Need proxy support for providers

fakegit opened this issue ยท 5 comments

For me, I need proxy to use telegram and discord, hope this project has proxy support

Thanks for opening your first issue here! Be sure to follow the issue template! ๐Ÿ‘‹๐Ÿž๐Ÿ‘‹

Could you please elaborate on your use case?

telegram is blocked at where i lived, i must send notification to telegram through proxy, i'd like function like the code bellow:

from notifiers import get_notifier  
proxies = {'http': 'http://127.0.0.1:1080', 'https': 'socks5://127.0.0.1:1080'}
telegram = get_notifier('telegram')  
telegram.notify(message='Hi!', token='TOKEN', chat_id=1234, proxies=proxies)  ```

Yeah, this is very doable. Currently the base URL is a class attribute, but making it passable should be fairly straightforward

Since notifiers uses requests, seems like there's a workaround for this:

$ export HTTP_PROXY="http://10.10.1.10:3128"
$ export HTTPS_PROXY="http://10.10.1.10:1080"

$ python
>>> import requests
>>> requests.get('http://example.org')