-
-
Save sharonhoward/476ee5f7eab0402a09f0e08356be0a8c to your computer and use it in GitHub Desktop.
Revisions
-
andrewheiss revised this gist
Sep 22, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -35,5 +35,5 @@ resp <- request("https://bsky.social/xrpc/com.atproto.repo.createRecord") |> record = post_body )) # Actually make the request and post the thing resp |> req_perform() -
andrewheiss revised this gist
Sep 22, 2023 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,7 @@ # ------------------------------------------------------------------------------------------ # Basically all translated from the Python example at https://atproto.com/blog/create-post # ------------------------------------------------------------------------------------------ library(httr2) # Create a logged-in API session object -
andrewheiss revised this gist
Sep 22, 2023 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ # Basically all translated from the Python example at https://atproto.com/blog/create-post library(httr2) # Create a logged-in API session object -
andrewheiss created this gist
Sep 22, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ library(httr2) # Create a logged-in API session object session <- request("https://bsky.social/xrpc/com.atproto.server.createSession") |> req_method("POST") |> req_body_json(list( identifier = Sys.getenv("BSKY_USER"), password = Sys.getenv("BSKY_PASS") )) |> req_perform() |> resp_body_json() # This is the token you can use for other API calls: # session$accessJwt # Create a post as a list post_body <- list( "$type" = "app.bsky.feed.post", text = "Test post from {httr2}", createdAt = format(as.POSIXct(Sys.time(), tz = "UTC"), "%Y-%m-%dT%H:%M:%OS6Z"), langs = list("en-US") ) # Post the post resp <- request("https://bsky.social/xrpc/com.atproto.repo.createRecord") |> req_method("POST") |> req_headers(Authorization = paste0("Bearer ", session$accessJwt)) |> req_body_json(list( repo = session$did, collection = "app.bsky.feed.post", record = post_body )) # Actuall make the request and post the thing resp |> req_perform()