I have done everything correctly and putted everything key correctly. So why it is showing the error.
`import tweepy
import openai
# replace the placeholders with your own keys and tokens
consumer_key = 'my-key'
consumer_secret = 'my-secret'
access_token = 'my-token'
access_token_secret = 'my-toke n'
openai.api_key = "openai-key"
response = openai.Completion.create(
model="text-davinci-003",
prompt="give a unique and short thrilling horror story which scares the humans for a tweet with no hashtags\n",
temperature=1,
max_tokens=256,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
text=response.choices[0].text + " #horror #scary #creepy #creepypasta"
def tweet_now():
msg = text
try:
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
try:
api.verify_credentials()
print("Authentication OK")
except:
print("Error during authentication")
# Create a client instance
client = tweepy.Client(auth)
tweet=client.create_tweet(text=msg,)
print(msg)
print("Tweeted")
except Exception as e:
print(e)
tweet_now()
print(text+'\n\nDone!')`
But is giving this error
Authentication OK
Consumer key must be string or bytes, not NoneType
She woke up in a cold sweat,realizing it wasn't a dream. The noises coming from outside were growing louder and closer. She knew what it was coming for her and she had to run. But, too late. The door burst open and the creature was here. #horror #scary #creepy #creepypasta
Done!
I was expecting that it tweets a horror story.