python273 / telegraph

Telegraph API wrapper | Telegra.ph
https://pypi.org/project/telegraph/
MIT License
287 stars 43 forks source link

Add request_kwargs to TelegraphApi, which will be used in requests #41

Closed Antares0982 closed 2 years ago

Antares0982 commented 2 years ago

Hello, I'm trying to use telegraph api but I cannot resolve host api.telegra.ph on my server correctly these days. So I considered using proxy in requests, but there is no way to pass proxies argument in telegraph api.

This pr Added a request_kwargs attribute to TelegraphApi and modified method() and will solve this. For example, set

request_kwargs = {'proxies': {
            "http": proxy_url,
            "https": proxy_url
        }}

then requests will use proxy_url as proxy. This supports other keyword arguments used by requests as well.

This pr will not affect normal use if request_kwargs is not needed. Resolves #22