Skip to content
/ butterfly Public template

Examples of `blue-yonder` package usage

License

Notifications You must be signed in to change notification settings

alxfed/butterfly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Butterfly

This is a template repository for using the 'blue-yonder' package. In order to create a repository with this template in your account or the account of your organization just click the 'Use this template' button on the top of this page and fill all the necessary information about ownership of the repository. The copy of this repo will appear in your account where you will be able to use and modify it the way you want. image description
The blue-yonder package is a pypi Python package that allows you to program your own automation of simple tasks on BlueSky network using Python. It can also be your door to the brave new world of AI, because it can serve as a connector between your Language Models and your social presence account on BlueSky if you know Python and can write programs that you need.

Installation of 'blue-yonder' package

To install the blue-yonder package from pypi.org, run the following command in your terminal:

pip install blue-yonder 

Usage

To use the blue-yonder package, import it in your Python code:

from blue_yonder import Actor, Another, yonder

Notice that the name of the library that you are using is blue_yonder, with an underscore.
There are more 'playful' aliases for the blue_yonder Client too; namely:

from blue_yonder import Butterfly, Flower, yonder

This is because Butterflies are the main 'clients' of the blue sky of course... and they interact with Flowers.

After using this template repository to create your own repository in your account, clone it to your computer and create a git excluded file .env using a .env_example format; use it to set the environment variables. As an alternative you can use git excluded config.yaml file formatted as it is shown in config_example.yaml file and go_configure function in a py file next to it.

Examples

The BlueSky service uses handle, password as well as assessions and tokens associated with your account that let you make changes in the environment of the BlueSky. While authorized you can post text or images, change the preferences of your account and perform many other actions.

The best way to let your Python programs work with the BlueSky API is to use an .env file to store all the necessary credentials, which will be used automatically by the blue-yonder package in your log-in. As an alternative you can store them in a config.yaml file (and exclude it from git).

In browser all the necessary credentials obtained from BlueSky when you log-in are (automatically) stored in cookies of your browser, but if you are building your own automation you need to take care of that youself. This mechanism will help the Bluesky service to avoid overloads and will also save you 'limits' (there is a maximum number of authenticated API calls that you can make per minute and per day).

This is a most basic example of a plain text post that will be on your profile.

text = 'This is a post.'
my_actor = Actor()
result = my_actor.post(text)
post = 'https://bsky.app/profile/multilogue.bsky.social/post/3lfngdvswe725'
reply_text = 'This is a reply'
reply = my_actor.in_reply_to(post).post(reply_text)

This is an example of a plain text post quoting any other Bluesky post.

url = 'https://bsky.app/profile/bsky.app/post/3l6oveex3ii2l'
result = my_actor.with_quoted_post(url).post(plain_text)

You can add a quote of another Bluesky post to a reply.

url = 'https://bsky.app/profile/bsky.app/post/3l6oveex3ii2l'
reply = my_actor.in_reply_to(post).with_quoted_post(url).post(reply_text)

This is an example of a text (which can be an empty string) post with an embedded image.

This is an example of a post with a link (actually a 'site card') to a page on any external site.

About

Examples of `blue-yonder` package usage

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages