Search code examples
pythontwittertweepy

I'm not sure where I made a mistake here, i'm currently using tweepy, python and working with the twitter api


I was working on quick replies for twitter dms, using tweepy and python, however i came across an issue.

def dm():
    followers = api.followers()
    for follower in followers:
        print(follower.id)
        reply_options = [
                {
                        "label": "A title test",
                        "description": "Just a description test",
                        "metadata": "external_id_1"
                },
                {
                        "label": "A title test 2",
                        "description": "Test Description 2",
                        "metadata": "external_id_2"

                }
        ]
        api.send_direct_message(follower.id,"Text", quick_reply_type="options",quick_reply_options = reply_options)        

And I was met with this output:

File "c:/Users/Azizah Blackwood/Documents/GitHub/just-a-chatbot-test/chatBot.py", line 58, in <module>
    dm()
  File "c:/Users/Azizah Blackwood/Documents/GitHub/just-a-chatbot-test/chatBot.py", line 54, in dm
    api.send_direct_message(follower.id,"Text", quick_reply_type="options",quick_reply_options = reply_options)
TypeError: send_direct_message() got an unexpected keyword argument 'quick_reply_options'

I was following through what I read here to add options to test if it would work.


Solution

  • quick_reply_options is not in current version of tweepy: https://github.com/tweepy/tweepy/pull/1364

    It may be added later, but for now, you need to stay within the params of the current version.