twitter-api-client icon indicating copy to clipboard operation
twitter-api-client copied to clipboard

Add proxies support

Open obnoxiousmods opened this issue 1 year ago • 5 comments

Hi Trevor thanks for creating this repository, very very helpful for my current project. Also from vancouver <3

But anyways, I was looking at the best way I could use proxies with the Account class, and while the Account class does indeed take a session kwarg it checks to see if the session is authenticated, if I want to authenticate with email user password I could import the Login function and do that and get an authenticated Client

BUT if I do that it will login without the proxy and Login does not accept a session kwarg it creates a Client from HTTPX and even though **kwargs gets passed along to __validate_session and then to login it gets used in execute_login_flow kwargs not the Client kwargs

So I think the best patch would be to include a proxies=kwargs.pop("proxies", None) in Client for the login function

For cookies auth, I recommend adding kwargs.pop('proxies', None) to proxies= for their Clients as well in __validate_session

I might be able to make a pull request but its like a couple lines so i imagine it could be added with ease

Thanks for reading

obnoxiousmods avatar Dec 11 '23 23:12 obnoxiousmods

@obnoxiousish How did you get proxies to work for you? I couldn't get it to work for me. Please can you help with how I can subclass Scraper, Account and Search classes so I can use proxies with it?

seoprodaddy avatar Jan 20 '24 03:01 seoprodaddy

https://github.com/obnoxiousish/async_twitter_api_client proxy support was added in my async version ( i think it might be missing a couple endpoints, i dont remember, + readme is outdated at time of posting this, uses asyncAuthenticate now instead of ainit

obnoxiousmods avatar Jan 20 '24 04:01 obnoxiousmods

i'm new here, thanks for all your write it help me a lot.

but i more explanation, could you share account.cookies look a like? where i can write that cookies/account so i can use it without getting notifications on my twitter "logging with new device".

thank in any advance

bayugtt avatar Jan 28 '24 10:01 bayugtt

i'm new here, thanks for all your write it help me a lot.

but i more explanation, could you share account.cookies look a like? where i can write that cookies/account so i can use it without getting notifications on my twitter "logging with new device".

thank in any advance

@trevorhobenshield 's official git repo supports saving cookies to file via .save_cookies() or something, look over account.py

obnoxiousmods avatar Jan 28 '24 10:01 obnoxiousmods

i'm new here, thanks for all your write it help me a lot. but i more explanation, could you share account.cookies look a like? where i can write that cookies/account so i can use it without getting notifications on my twitter "logging with new device". thank in any advance

@trevorhobenshield 's official git repo supports saving cookies to file via .save_cookies() or something, look over account.py

thank, got it.

bayugtt avatar Feb 11 '24 09:02 bayugtt