I've looked through the documentation but only found documentation indicating that Tweepy supports proxied requests through the v1 API. I have an essential developer account so I am limited to using the v2 API. As a workaround, I wrote an API call in Python using the requests library as it does give me the ability to specify a proxy URL but in retrospect, I am now wondering if I could've done this with Tweepy after all. I'd be surprised if proxy support was removed from Tweepy for the v2 API.
Tweepy client uses requests (requests.Session)
under the hood. You can inherit from the client and update/overwrite the session object to use proxies. Try this:
Solution 1. Subclassing tweepy.Client
import tweepy
class Client(tweepy.Client):
def __init__(self, proxies, *args, **kwargs):
super().__init__(*args, **kwargs)
self.session.proxies = proxies
Solution 2. Using session object in tweepy.Client
import tweepy
client = tweepy.Client(...)
client.session.proxies = {...} # put your proxies here