Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy. #14

Open
eurealty opened this issue Jul 19, 2021 · 2 comments · May be fixed by #15
Open

Proxy. #14

eurealty opened this issue Jul 19, 2021 · 2 comments · May be fixed by #15

Comments

@eurealty
Copy link

Hello.
Could you add the ability to work through a proxy?
Best regards.

@mercuree mercuree linked a pull request Jul 19, 2021 that will close this issue
@mercuree
Copy link
Owner

mercuree commented Jul 19, 2021

You know, there are too much work for the refactoring, I don't know how to make it correctly and not to break an existing api.
But you have two options:

# install modified version
pip install git+https://github.com/mercuree/html-telegraph-poster.git@pass_request

then you can create an instance like this (anyway i didn't test it):

# use the docs to configure it [properly ](https://docs.python-requests.org/en/master/user/advanced/#proxies)
proxies = {
  'http': 'http://10.10.1.10:3128',
  'https': 'http://10.10.1.10:1080',
}
r = requests.Session()
r.proxies.update(proxies)

t = TelegraphPoster(use_api=True, request=r)

@eurealty
Copy link
Author

I tried it, but it doesn't work for me.
Most likely it's my bad hands)
But without "import requests" the code doesn't work,
and when I import "requests", it sends everything
from any specified proxy (for example: 1.1.1.1:1111),
which means sending through proxies doesn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants