• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Bytewerk/MastodonStatus: read hackerspace open state from spaceapi JSON and upda ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

Bytewerk/MastodonStatus

开源软件地址(OpenSource Url):

https://github.com/Bytewerk/MastodonStatus

开源编程语言(OpenSource Language):

Python 100.0%

开源软件介绍(OpenSource Introduction):

update mastadon profile field with spaceapi state

this script tries to fetch a spaceapi (http://spaceapi.net/) JSON file, parses the current space state (open / closed, since when) and updates a mastadon profile custom field to reflect this state.

install

# git clone https://github.com/Bytewerk/MastodonStatus.git
# cd MastodonStatus
# python3 -m venv venv
# venv/bin/activate
# pip install -r requirements.txt
# cp settings.py.template settings.py

update config in settings.py

  • set INSTANCE_URL to the base URL of your mastadon instance, e.g. 'https://chaos.social'
  • set SPACE_API_URL to the URL of your spaceapi json file
  • set STATE_FIELD_NAME to the name of the profile field whose value should be overwritten by this script you have to create this field by yourself, e.g. via your instance's website
  • set STATE_[OPEN|CLOSED|UNKNOWN] texts as you like

generate access token

the script needs a mastadon API token to operate. you can e.g. generate that from a python REPL:

# python3
>>> from settings import *
>>> Mastodon.create_app('myhackerspace_open_status', api_base_url=INSTANCE_URL, to_file=CLIENT_ID_FILENAME)
>>> mastodon = Mastodon(client_id=CLIENT_ID_FILENAME, api_base_url=INSTANCE_URL)
>>> mastodon.log_in('[email protected]', 'incrediblygoodpassword', to_file=ACCESS_TOKEN_FILENAME)

profit!

run the script once to check that it works, then let it run periodically, e.g. from cron.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
ServerWrestler/rss2mastodon: Convert an XML feed to a new Mastodon status.发布时间:2022-08-17
下一篇:
urahito/MastodonSStool发布时间:2022-08-17
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap