Coder Social home page Coder Social logo

uttaravadina / twitter-threader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from iyanuashiri/twitter-threader

0.0 0.0 0.0 26 KB

A Twitter API library for threads

Home Page: https://github.com/iyanuashiri/twitter-threader

License: MIT License

Python 100.00%

twitter-threader's Introduction

twitter-threader

Introduction

Twitter Thread is a library to manage threads on Twitter. You can GET and POST threads on Twitter.

Installation

pip install twitter-threader

Usage

GET a thread on Twitter

import threader
import tweepy


consumer_key = 'CONSUMER_KEY'
consumer_secret = 'CONSUMER_SECRET'
access_token_key = 'ACCESS_TOKEN'
access_token_secret = 'ACCESS_TOKEN_SECRET'

def connect_api():
    auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
    auth.set_access_token(access_token_key, access_token_secret)
    api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True)
    return api

api = connect_api()

thread = threader.Thread(api)
thread.convert_to_post('1247616218153902080')

POST a thread on Twitter

import threader
import tweepy

consumer_key = 'CONSUMER_KEY'
consumer_secret = 'CONSUMER_SECRET'
access_token_key = 'ACCESS_TOKEN'
access_token_secret = 'ACCESS_TOKEN_SECRET'

def connect_api():
    auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
    auth.set_access_token(access_token_key, access_token_secret)
    api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True)
    return api


api = connect_api()


thread = threader.Thread(api)
username = 'YOUR USERNAME'
thread.post_thread('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Metus dictum at tempor commodo ullamcorper a lacus. Amet justo donec enim diam vulputate. Sit amet justo donec enim diam vulputate ut pharetra sit. Leo duis ut diam quam. At ultrices mi tempus imperdiet. Mauris augue neque gravida in fermentum. Fermentum posuere urna nec tincidunt praesent semper feugiat nibh. Placerat vestibulum lectus mauris ultrices eros in cursus turpis massa. In aliquam sem fringilla ut morbi tincidunt augue.',
                         username)

Testing

  • Add test

twitter-threader's People

Contributors

iyanuashiri avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.