


'''simple docstring'''
import csv

import tweepy

# Twitter API credentials
UpperCamelCase__    					=      ''''''
UpperCamelCase__    					=      ''''''
UpperCamelCase__    					=      ''''''
UpperCamelCase__    					=      ''''''





def 					a__       (					lowerCAmelCase__						)    ->	None:
    # authorize twitter, initialize tweepy
    UpperCAmelCase__			:		Optional[Any]													=				tweepy.OAuthHandler(lowerCAmelCase__  ,					lowerCAmelCase__						)
    auth.set_access_token(lowerCAmelCase__  ,					lowerCAmelCase__						)
    UpperCAmelCase__			:		str													=				tweepy.API(lowerCAmelCase__						)

    # initialize a list to hold all the tweepy Tweets
    UpperCAmelCase__			:		List[Any]													=				[]

    # make initial request for most recent tweets (200 is the maximum allowed count)
    UpperCAmelCase__			:		Optional[Any]													=				api.user_timeline(screen_name=lowerCAmelCase__  ,					count=2_00						)

    # save most recent tweets
    alltweets.extend(lowerCAmelCase__						)

    # save the id of the oldest tweet less one
    UpperCAmelCase__			:		Optional[int]													=				alltweets[-1].id - 1

    # keep grabbing tweets until there are no tweets left to grab
    while len(lowerCAmelCase__						) > 0:
        print(F"""getting tweets before {oldest}"""						)

        # all subsequent requests use the max_id param to prevent duplicates
        UpperCAmelCase__			:		Union[str, Any]													=				api.user_timeline(
            screen_name=lowerCAmelCase__  ,					count=2_00  ,					max_id=lowerCAmelCase__						)

        # save most recent tweets
        alltweets.extend(lowerCAmelCase__						)

        # update the id of the oldest tweet less one
        UpperCAmelCase__			:		List[str]													=				alltweets[-1].id - 1

        print(F"""...{len(lowerCAmelCase__						)} tweets downloaded so far"""						)

    # transform the tweepy tweets into a 2D array that will populate the csv
    UpperCAmelCase__			:		List[str]													=				[[tweet.id_str, tweet.created_at, tweet.text] for tweet in alltweets]

    # write the csv
    with open(F"""new_{screen_name}_tweets.csv"""  ,					'''w'''						) as f:
        UpperCAmelCase__			:		List[str]													=				csv.writer(lowerCAmelCase__						)
        writer.writerow(['''id''', '''created_at''', '''text''']						)
        writer.writerows(lowerCAmelCase__						)


if __name__ == "__main__":
  # pass in the username of the account you want to download
  get_all_tweets('''FirePing32''')




'''simple docstring'''
import pprint

import requests

UpperCamelCase__    					=      '''https://zenquotes.io/api'''





def 					a__       (					)    ->	list:
    return requests.get(API_ENDPOINT_URL + '''/today'''						).json()





def 					a__       (					)    ->	list:
    return requests.get(API_ENDPOINT_URL + '''/random'''						).json()


if __name__ == "__main__":
  UpperCamelCase__    					=      random_quotes()
  pprint.pprint(response)
