Rédaction en cours
Documentation : https:dev.twitter.com/docs/api/1.1 Fonction pour tweeter : POST statuses/update_with_media. Choisir le mode d'authentification : https://dev.twitter.com/docs/auth/obtaining-access-tokens Mon choix : https://dev.twitter.com/docs/auth/tokens-devtwittercom https://dev.twitter.com/docs/auth/oauth/single-user-with-examples Installation de requests_oauthlib (dépendances oauthlib, requests) Génération des clés Oauth : http://dev.twitter.com Code pour poster un tweet : <code python> #!/usr/bin/env python3 import requests from requests_oauthlib import OAuth1 #PROXIES={“https”:“http://cache.univ-poitiers.fr:3128”} PROXIES={} url = “https://api.twitter.com/1.1/statuses/update.json” client_key = 'XXXX' client_secret = 'YYYY' resource_owner_key = 'ZZZZ' resource_owner_secret = 'AAAA' texte=“COUCOU EN MOINS DE 140 chars” headeroauth = OAuth1(client_key, client_secret, resource_owner_key, resource_owner_secret, signature_type = 'auth_header') r=requests.post(url,data={'status' : texte},proxies=PROXIES,auth = headeroauth) </code>