this repo has no description

autoposters/bskycharts.py: point to CGI service

+10 -9
+10 -9
autoposters/bskycharts.py
··· 3 3 import time 4 4 5 5 import atproto 6 + import requests 6 7 7 8 8 9 BSKY_HANDLE = 'bskycharts.edavis.dev' 9 10 BSKY_APP_PASSWORD = '' 10 - BSKY_ACTIVITY_IMAGE_PATH = '/var/www/munin/edavis.dev/bskycharts.edavis.dev/bsky-day.png' 11 + BSKY_ACTIVITY_IMAGE_URL = 'https://bskycharts.edavis.dev/munin-cgi/munin-cgi-graph/edavis.dev/bskycharts.edavis.dev/bsky-day.png' 11 12 12 13 13 14 def main(): 14 - time.sleep(10) # let the charts finish updating 15 - 16 15 client = atproto.Client() 17 16 client.login(BSKY_HANDLE, BSKY_APP_PASSWORD) 18 17 19 - with open(BSKY_ACTIVITY_IMAGE_PATH, 'rb') as chart: 20 - client.send_image( 21 - text = '', 22 - image = chart.read(), 23 - image_alt = 'munin chart showing daily bluesky network activity' 24 - ) 18 + resp = requests.get(BSKY_ACTIVITY_IMAGE_URL) 19 + resp.raise_for_status() 20 + 21 + client.send_image( 22 + text = '', 23 + image = resp.content, 24 + image_alt = 'munin chart showing daily bluesky network activity' 25 + ) 25 26 26 27 27 28 if __name__ == '__main__':