【发布时间】:2022-11-23 05:35:08
【问题描述】:
错误 ”
Traceback (most recent call last):
File "/home/dcaus/tweet-custom-label.py", line 16, in <module>
api.update_with_media(filename, status, in_reply_to_status_id = in_reply_to_status_id)
NameError: name 'api' is not defined
“ 我的代码
import tweepy
# Authenticate to Twitter
auth = tweepy.OAuthHandler("Token Is Hidden For Privacy.", "Token Is Hidden For Privacy.")
auth.set_access_token("Token Is Hidden For Privacy.", "Token Is Hidden For Privacy.")
# Create API object
status = "This is cool"
in_reply_to_status_id = "1595131614425542656"
filename = "Property 1=Default.png"
api.update_with_media(filename, status, in_reply_to_status_id = in_reply_to_status_id)
【问题讨论】:
-
您永远不会创建
api对象。