Skip to main content

Byte API Wrapper for Python

Project description

pybyte-logo


A Python wrapper for the byte.co app.

Python 3.6+ Required.


Attention: This project was built in a weekend (mostly in the weekend that it was launched) as such this is not production level software.

Byte does not have an official web API for developers, and most likely this will violate the ToS. Endpoints were found from the mobile app. As such, this wrapper can break at anytime. Do not rely on this wrapper.


Installation

  • PyPi (Recommended)
    pip install pybyte
    
  • Git repo
    git clone https://github.com/ms7m/py-byte
    cd py-byte
    python3 setup.py install
    

Usage

>>> import pybyte
>>> byte = pybyte.Byte(TOKEN)
>>> byte.me().username
'cmmvo22123'
>>>

>>> # View your timeline
>>> my_timeline = byte.me().timeline()
>>> # iterate over your timeline feed
>>> for post in my_timeline.feed:
>>>     print(post.caption)
>>>     print(post.author)
>>>     post.comment("Hey!")



>>> # Set your username/display name/biography
...
>>> byte.me().username = "BotBottyFace220"
>>> byte.me().username
'BotBottyFace220'

>>> # Get Posts
>>> post = byte.get_post("4ZPUKLE5OZB7JJGIBLVMIYQLBU")
>>> post.caption
'@peaks'
>>> post.mentions
[mention1]

# Rebyte/Like posts
>>> post.rebyte()
>>> post.like()

# Comment Posts
>>> post.comment("That's really funny!")


# Upload Posts
>>> byte.upload("sample.mp4", caption="Megan is too funny!")

Example Script

# Go through the global feed, comment and follow the author if they have < 10 followers

global_feed = byte.me().global_feed()

for post in global_feed.feed:
    if post.author.followers['followerCount'] > 10:
      	post.comment("Hey man, thanks for making me laugh!")
        post.like()
    else:
      	continue

Example Scripts

# Go through your posts and comment any post older than 3 days and has less than 200 likes

my_posts = byte.me().posts()
time_now = datetime.datetime.now()

for post in my_posts.feed:
    if (time_now - post.date).days > 3:
        if post.like_count < 200:
            # i am not popular :(
            post.comment("this post isn't making me popular")
         else:
            post.comment("Woohoo! I'm very popular!")
    else:
        # not old enough
        continue

Tests

Coming soon

Project details


Download files

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

Source Distribution

pybyte-0.1.7.tar.gz (33.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pybyte-0.1.7-py3-none-any.whl (31.7 kB view details)

Uploaded Python 3

File details

Details for the file pybyte-0.1.7.tar.gz.

File metadata

  • Download URL: pybyte-0.1.7.tar.gz
  • Upload date:
  • Size: 33.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.5

File hashes

Hashes for pybyte-0.1.7.tar.gz
Algorithm Hash digest
SHA256 79a2cee7d69bc836419fd713b9f855038b515de4a3697cacdaf202e1af27a477
MD5 c3ac4deb16d221847db48960c200863b
BLAKE2b-256 32e1d72bf7436cbf00697cd844205f3a08dc77a6142c9a5682a16617dfa9037a

See more details on using hashes here.

File details

Details for the file pybyte-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: pybyte-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 31.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.5

File hashes

Hashes for pybyte-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 17c920a537eb228c20456b429cb365d66cbbb6c0d186124773273f67462f9821
MD5 874aab9e9f4cbc84a7304de809aad330
BLAKE2b-256 2158dfbf8da4a264716073141c338841c58ca6d817088ba98ddac5c22ae9b1c8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page