senooken JP Social
  • FAQ
  • Login
senooken JP Socialはsenookenの専用分散SNSです。
  • Public

    • Public
    • Network
    • Groups
    • Popular
    • People

Untitled attachment

Download link

Notices where this attachment appears

  1. sumiyaki (sumiyaki@plr.ph3j.com@plr.ph3j.com)'s status on Sunday, 05-May-2019 02:58:52 JST sumiyaki sumiyaki
    Pleromaで Mastodon API叩いて、投稿する練習してます。
    OAuthでAccess Tokenを取得するまで、Pythonで書いてみた。
    その先、投稿するとき、text/htmlで投稿するのができた。

    JSONを
    parameters = \
    {
    'status' : '<a href="https://www.asahi.com/">朝日新聞</a>',
    'content_type' : 'text/html'
    }
    のように書いて、

    url = 'https://pleroma.example.com/api/v1/statuses'
    req = requests.post(url, headers={'Authorization': 'Bearer ' + access_token}, json=parameters)

    Mastodon APIのライブラリはたくさんあるから、
    https://github.com/tootsuite/documentation/blob/master/Using-the-API/Libraries.md
    こんなことを自分で書く必要はないのだけど、こういうPleroma独自?のことを試して見るには、出来合いのライブラリをそのまま使うだけではうまくいかないかもしれない。(本当は道草食っていてはいけないのだけど)

    #Pleroma #Mastodon #API #bot
    In conversation Sunday, 05-May-2019 02:58:52 JST from plr.ph3j.com permalink
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

senooken JP Social is a social network, courtesy of senooken. It runs on GNU social, version 2.0.2-beta0, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All senooken JP Social content and data are available under the Creative Commons Attribution 3.0 license.