twintproject / twint

An advanced Twitter scraping & OSINT tool written in Python that doesn't use Twitter's API, allowing you to scrape a user's followers, following, Tweets and more while evading most API limitations.
MIT License
15.64k stars 2.72k forks source link

Why does token.py use requests lib, It doesn't be same as core code like get.py #1389

Open borgle opened 2 years ago

borgle commented 2 years ago
class Token:
    def __init__(self, config):
        self._session = requests.Session()
        self._session.headers.update({'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0'})
        self.config = config
        .....

when I test Twint, I found the code above didn't use the config info Proxy_type, Proxy_host, Proxy_port. but I modify it and added the below code, and it works.

        if config.Proxy_type and config.Proxy_host and config.Proxy_port:
            self._session.proxies = {
                'https': '{}://{}:{}'.format(config.Proxy_type, config.Proxy_host, config.Proxy_port)
            }