मैं इस छोटे से पिछले महीनेTwython के साथ ट्विटर पर छवि कैसे पोस्ट करें?
from twython import Twython
import glob
import random
app_key = "XXX"
app_secret = "XXX"
oauth_token = "XXX"
oauth_token_secret = "XXX"
twitter = Twython(app_key, app_secret, oauth_token, oauth_token_secret)
def RandomImageTwitt(folder):
#Takes the folder where your images are as the input
images = glob.glob(folder + "*")
image_open = open(images[random.randint(0,len(images))-1])
twitter.update_status_with_media(media=image_open)
RandomImageTwitt("/home/XXX/.reddit-twitter-image/XXX/")
के लिए पूरी तरह से काम कर रहा था लेकिन अब स्क्रिप्ट ट्विटर इस विधि का त्याग दिया है। Twython मुझे बताता है कि मुझे Twython.upload_media का उपयोग करना चाहिए, लेकिन मुझे इसके उपयोग पर कोई दस्तावेज़ नहीं मिल रहा है। यहां तक कि Twython आधिकारिक साइटें अभी भी update_status_with_media के साथ एक उदाहरण सूचीबद्ध करती हैं।
किसी को भी जानता है कि यह कैसे करना है या जहां कुछ उदाहरण/अधिक जानकारी के लिए?
धन्यवाद है! अंत में, मैंने रैपर को बदल दिया और tweepy के साथ चला गया। यह मेरी राय में, सरल है। https://github.com/joaquinlpereyra/ImageTwitterBot/blob/master/ImageTwitterBot.py – joaquinlpereyra
आप प्रलेखन यहाँ पा सकते हैं:: https: //twython.readthedocs.org/en/latest/api आप GitHub पर कोड देख सकते हैं। एचटीएमएल – Txugo