Bluesky Avatar Updater#
Overview#
This repository contains a Python script intended to update your Bluesky avatar automatically based on the current hour. The script utilises environment variables for configuration and reads a JSON file of blob CIDs to determine the appropriate avatar for each hour. Please note that the implementation is not yet fully operational, as several issues remain to be resolved. This script was inspired by @dame.is's blog post 'How I made an automated dynamic avatar for my Bluesky profile'.
Prerequisites#
Before running the script, ensure you have the following:
-
Python 3.6 or later installed.
-
The required Python packages:
python-dotenvatproto- Standard libraries such as
os,json,logging, anddatetime
-
A valid Bluesky account with the necessary API credentials.
Installation#
-
Clone the repository:
git clone https://github.com/ewanc26/bluesky-avatar-updater.git cd bluesky-avatar-updater -
Create a virtual environment and install dependencies:
python3 -m venv .venv source .venv/bin/activate # On Windows use: .venv\Scripts\activate pip install -r requirements.txt -
Configure environment variables:
-
Place your
.envfile in the../assetsdirectory relative to the script. -
The
.envfile should contain the following entries:ENDPOINT=your_endpoint HANDLE=your_handle PASSWORD=your_password
-
-
Prepare the JSON file:
- Ensure that a
cids.jsonfile is located in the../assetsdirectory. This file should map each hour (in two-digit format) to a corresponding blob CID.
- Ensure that a
Usage#
To run the script, execute:
python -u ./src/main.py
The script will:
- Load the environment configuration from
./assets/.env. - Read the blob CIDs from
./assets/cids.json. - Determine the current hour and select the appropriate blob CID.
- Attempt to authenticate and update the avatar using the AT Protocol.
Execution logs will be recorded in avatar_update.log for your review.
Known Issues#
At present, the script isn’t fully working. We’ve noticed an error when updating the profile—specifically, the put_record() method is missing a required parameter. There have also been occasional authentication hiccoughs, which might be due to configuration issues or API quirks.
If you’re keen to help sort these out or have ideas for improvements, please open a Pull Request. Your contributions are very welcome!
Licence#
This project is released under the MIT Licence. See the LICENSE file for full details.