tangled
alpha
login
or
join now
edavis.dev
/
bsky-tools
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
pulls
pipelines
autoposters/bskycharts.py: point to CGI service
Eric Davis
2 years ago
669a9d41
77588413
+10
-9
1 changed file
expand all
collapse all
unified
split
autoposters
bskycharts.py
+10
-9
autoposters/bskycharts.py
···
3
3
import time
4
4
5
5
import atproto
6
6
+
import requests
6
7
7
8
8
9
BSKY_HANDLE = 'bskycharts.edavis.dev'
9
10
BSKY_APP_PASSWORD = ''
10
10
-
BSKY_ACTIVITY_IMAGE_PATH = '/var/www/munin/edavis.dev/bskycharts.edavis.dev/bsky-day.png'
11
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
14
-
time.sleep(10) # let the charts finish updating
15
15
-
16
15
client = atproto.Client()
17
16
client.login(BSKY_HANDLE, BSKY_APP_PASSWORD)
18
17
19
19
-
with open(BSKY_ACTIVITY_IMAGE_PATH, 'rb') as chart:
20
20
-
client.send_image(
21
21
-
text = '',
22
22
-
image = chart.read(),
23
23
-
image_alt = 'munin chart showing daily bluesky network activity'
24
24
-
)
18
18
+
resp = requests.get(BSKY_ACTIVITY_IMAGE_URL)
19
19
+
resp.raise_for_status()
20
20
+
21
21
+
client.send_image(
22
22
+
text = '',
23
23
+
image = resp.content,
24
24
+
image_alt = 'munin chart showing daily bluesky network activity'
25
25
+
)
25
26
26
27
27
28
if __name__ == '__main__':