Skip to main content

A proof-of-concept sentence-oriented Twitter API client for Python, based on 'birdy'.

Project description

Larry Birdy

Larry Birdy is based on 'birdy' and is sentence-oriented (i.e. sprinkled with syntactic sugar). Through an experimental (and fuzzy oop design) and proof-of-concept way, you can make API calls with exprensiveness (and verbosity).

Install

pip install larry-birdy

Example

from larry.twitter import RestAPI, p

API = RestAPI(CONSUMER_KEY,
              CONSUMER_SECRET,
              ACCESS_TOKEN,
              ACCESS_TOKEN_SECRET)

OWNER = API.verify_account_credentials(skip_status=True)

query = '#python #twitter -rt'
tweet_instances = API.search_tweets(q=query,
                                    result_type='recent',
                                    lang='en',
                                    count=10,
                                    tweet_mode='extended')

# You can write "sentences" like the following:

content_has_media = p.Does.this(status=tweet_instance).have_element('media')
                        # Does this [status] have (the) element ['media']?

hashtags_number = p.Find.for_element('hashtags').its_number_within(tweet_instance)
                    # Find, for (the) element ['hashtags'], its number within (this) [status].

mentions = p.Get.element('user_mentions').from_(tweet_instance)
            # Get (the) element ['user_mentions'], from (this) [status].

user = tweet_instance.user
user_is_following_owner = p.Is.this(user).following(OWNER)
                            # Is this [user] following [OWNER]?

try:
    API.retweet(tweet=tweet_instance, trim_user=True)
except Exception as error_message:
    print(error_message)

Project details


Release history Release notifications

This version

0.0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for larry-birdy, version 0.0.1
Filename, size & hash File type Python version Upload date
larry_birdy-0.0.1-py3-none-any.whl (4.1 kB) View hashes Wheel py3
larry-birdy-0.0.1.tar.gz (3.7 kB) View hashes Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page