Skip to content

Instantly share code, notes, and snippets.

@edsu
Last active June 4, 2023 09:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edsu/a1d05c496063c518f68b8b17db2f285f to your computer and use it in GitHub Desktop.
Save edsu/a1d05c496063c518f68b8b17db2f285f to your computer and use it in GitHub Desktop.
A test of the Pinboard API
#!/usr/bin/env python3
import os
import dotenv
import requests
#
# You'll need to put your Pinboard API token in a .env file in the same directory as this program.
#
# PINBOARD_KEY=abc:123
#
dotenv.load_dotenv()
pinboard_key = os.environ.get("PINBOARD_KEY")
resp = requests.get(f"https://api.pinboard.in/v1/posts/add?description=Time%20to%20Dial%20it%20Back%3A%20We%20Humans%20have%20Exceeded%20the%20Boundaries%20of%2080%25%20of%20the%20Planet%27s%20Key%20Systems&url=https%3A%2F%2Fwww.juancole.com%2F2023%2F06%2Fexceeded-boundaries-planets.html&extended=&tags=&format=json&shared=yes&toread=no&auth_token={pinboard_key}")
print(resp.status_code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment