Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/random-robbie/natrail-bot
This project automates the posting of railway disruptions to Bluesky using the atproto Python SDK. It fetches disruption information, formats it, and posts it with relevant URLs and hashtags.
https://github.com/random-robbie/natrail-bot
bluesky bluesky-bot bluesky-social bsky-bot national-rail rail train trains-delayed trains-information ukrail
Last synced: about 2 months ago
JSON representation
This project automates the posting of railway disruptions to Bluesky using the atproto Python SDK. It fetches disruption information, formats it, and posts it with relevant URLs and hashtags.
- Host: GitHub
- URL: https://github.com/random-robbie/natrail-bot
- Owner: random-robbie
- License: mit
- Created: 2024-11-19T14:54:02.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-29T14:35:27.000Z (about 2 months ago)
- Last Synced: 2024-11-29T15:33:14.128Z (about 2 months ago)
- Topics: bluesky, bluesky-bot, bluesky-social, bsky-bot, national-rail, rail, train, trains-delayed, trains-information, ukrail
- Language: Python
- Homepage: https://bsky.app/profile/natrail-bot.bsky.social
- Size: 49.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# Natrail Disruptions Poster
This project automates the posting of railway disruptions to Bluesky using the atproto Python SDK.
It fetches disruption information, formats it, and posts it with relevant URLs and hashtags.
It uses the flickr api to retrive images for posts thumbs
Current Bluesky Profile: https://bsky.app/profile/natrail-bot.bsky.social
Data Taken from: https://www.nationalrail.co.uk/status-and-disruptions/
## Features
- **Automated Disruption Fetching**: Automatically fetches the latest railway disruptions from a specified source.
- **URL and Hashtag Parsing**: Identifies and processes URLs and hashtags within the disruption messages to ensure they are clickable when posted.
- **Rate Limiting Handling**: Manages rate limits by retrying posts after a specified delay if rate limits are encountered.
- **Logging**: Provides detailed logging of the posting process for debugging and tracking.
- **Environment Configuration**: Uses environment variables for secure handling of login credentials.## Requirements
- Python 3.x
- `atproto` library
- `python-dotenv` library
- `flickrapi` library
- `requests` library
- `sqlite3` library
## Installation1. Clone the repository:
```bash
git clone https://github.com/random-robbie/natrail-bot.git
cd natrail-bot
```2. Install the required Python packages:
```bash
pip install -r requirements.txt
```3. Edit the `.env` file in the project root and add your Bluesky handle and password:
```env
BLUESKY_HANDLE=your-handle
BLUESKY_PASSWORD=your-password
FLICKR_API_KEY=your_api_key_here
FLICKR_API_SECRET=your_api_secret_here
```## Usage
Run the script to post the latest disruptions to Bluesky:
```bash
python natrail.py