this repo has no description
1# Loosely based on https://github.com/MarshalX/bluesky-feed-generator/
2
3import os
4
5from atproto import Client, models
6
7# YOUR bluesky handle
8# Ex: user.bsky.social
9HANDLE: str = os.environ["HANDLE"]
10
11# YOUR bluesky password, or preferably an App Password (found in your client settings)
12# Ex: abcd-1234-efgh-5678
13PASSWORD: str = os.environ["PASSWORD"]
14
15SERVICE_PDS: str | None = os.environ.get("SERVICE_PDS")
16
17# The hostname of the server where feed server will be hosted
18# Ex: feed.bsky.dev
19HOSTNAME: str = os.environ["ARTSCROLLING_HOSTNAME"]
20
21# A short name for the record that will show in urls
22# Lowercase with no spaces.
23# Ex: whats-hot
24RECORD_NAME: str = "artscrolling"
25
26# A display name for your feed
27# Ex: What's Hot
28DISPLAY_NAME: str = "Artscrolling"
29
30# (Optional) A description of your feed
31# Ex: Top trending content from the whole network
32DESCRIPTION: str = "Like doomscrolling, but with art"
33
34# -------------------------------------
35# NO NEED TO TOUCH ANYTHING BELOW HERE
36# -------------------------------------
37
38
39def main():
40 client = Client(base_url=SERVICE_PDS)
41 client.login(HANDLE, PASSWORD)
42
43 if not client.me:
44 raise RuntimeError
45
46 feed_did = f"did:web:{HOSTNAME}"
47
48 response = client.com.atproto.repo.put_record(
49 models.ComAtprotoRepoPutRecord.Data(
50 repo=client.me.did,
51 collection=models.ids.AppBskyFeedGenerator,
52 rkey=RECORD_NAME,
53 record=models.AppBskyFeedGenerator.Record(
54 did=feed_did,
55 display_name=DISPLAY_NAME,
56 accepts_interactions=True,
57 description=DESCRIPTION,
58 avatar=None,
59 content_mode=None,
60 created_at=client.get_current_time_iso(),
61 ),
62 )
63 )
64
65 print("Successfully published!")
66 print('Feed URI (put in "FEED_URI" env var):', response.uri)
67
68
69if __name__ == "__main__":
70 main()