-
Notifications
You must be signed in to change notification settings - Fork 1
/
feminitives.py
39 lines (33 loc) · 1.07 KB
/
feminitives.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import tweepy
from time import sleep
import json
from random import randint, seed
from pprint import pprint
from credentials import *
# Access and authorize Twitter credentials from credentials.py
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
with open('nouns-censored.json') as data_file:
list_data = json.load(data_file)
# pprint(data)
pprint(list_data[0]['masculinitive1'])
pprint(list_data[0]['feminitive1'])
def tweet():
#for index, nouns in enumerate(list_data, index):
index = 0
while(True):
index = seed()
index = randint(0, 234)
nouns = list_data[index]['feminitive1'] + " – фемінітив до слова " + list_data[index]['masculinitive1']
try:
print(nouns.capitalize())
if nouns != '\n':
api.update_status(nouns.capitalize())
sleep(900)
else:
pass
except tweepy.TweepError as e:
print(e.reason)
sleep(10)
tweet()