I'm building a Markov chain generator using Twython in Python 3.4 that takes my previous tweets as source input, generates a new tweet and posts that to Twitter. The issue I'm having is that when I'm passing the data into the twitter.update_status() method, I get this error:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python34\lib\tkinter\__init__.py", line 1533, in __call__
return self.func(*args)
File "C:\Users\joshs\OneDrive\Documents\markov generator.py", line 80, in send
twitter.post('statuses/update', params = {'status': tweet})
File "C:\Python34\lib\site-packages\twython\api.py", line 268, in post
return self.request(endpoint, 'POST', params=params, version=version)
File "C:\Python34\lib\site-packages\twython\api.py", line 258, in request
api_call=url)
File "C:\Python34\lib\site-packages\twython\api.py", line 194, in _request
retry_after=response.headers.get('X-Rate-Limit-Reset'))
twython.exceptions.TwythonError: Twitter API returned a 403 (Forbidden), Missing required parameter: status.
I've tried both:
def send():
global tweet
twitter.post('statuses/update', params = {'status': tweet})
and:
def send():
global tweet
twitter.update_status(status= tweet)
I've even tried explicitly passing the tweet variable as str(tweet) just in case I was being especially stupid and trying to pass a list or something. The string is definitely under 140 characters and doesn't contain any special characters, just A-Z and 0-9.
I'm calling the send() function using a Tkinter button, but I tried without and it still throws this error.
Is there something about not passing variables into Twython functions that I missed in the documentation?
Thanks in advance