I'm using jupyter notebook to make a code that reads a trump tweets database and trains to make its own tweets based on the ones on the db. I want to use tweepy to tweet the output however I can't seem to find a way to tweet it.
I tried adding the status update command at the end of the code
def generate_w_seed2(sentence,diversity):
sentence = sentence[0:maxlen]
generated = ''
generated += sentence
sys.stdout.write(generated)
for i in range(120):
x_pred = np.zeros((1, maxlen, len(chars)))
for t, char in enumerate(sentence):
x_pred[0, t, char_indices[char]] = 1.
preds = modelo.predict(x_pred, verbose=0)[0]
next_index = sample(preds, diversity)
next_char = indices_char[next_index]
generated += next_char
sentence = sentence[1:] + next_char
sys.stdout.write(next_char)
sys.stdout.flush()
print()
return
for s in random.sample(list(text),1):
for diversity in [0.5]:
generate_w_seed2(s,diversity)
print()
api.update_status(generate_w_seed2(s,diversity))
But I get the following error:
TweepError: [{'code': 170, 'message': 'Missing required parameter: status.'}]
I have also tried placing the variable in a function (named estado) and while it didn't read the variable it tweeted the following:
<function estado at 0x00000000E59DC6A8>