Browse Source

Build out get_all_posts; update readme.

master
jowj 3 years ago
parent
commit
50cc781149
  1. 4
      README.md
  2. 11
      pinboard.py

4
README.md

@ -20,7 +20,9 @@ Do i need to do anything here, actually, or is json fine?
### Putting data in pinboard
So far i've done nothing.
- [ ] Get regular auth to work
- [X] Get auth token to work
- Finally got this to work; I had a fundamental mistunderstanding of what pinboard meant by "method" in the URL.
- [X] Figure out how to pull existing posts
- [ ] Figure out how to post an item to my feed as public
- [ ] Figure out how to post an item to my feed as private
- [ ] Enable a conditional; NSFW items get posted as private, regular items as public.

11
pinboard.py

@ -1,10 +1,13 @@
import requests
import os
import pysnooper
pinboard_token = os.environ.get("PINBOARD_TOKEN")
pinboard_user = os.environ.get("PINBOARD_USER")
pinboard_password = os.environ.get("PINBOARD_PASSWORDD")
pinboard_url = f"https://{pinboard_user}:{pinboard_password}api.pinboard.in/v1"
pinboard_base_url = "https://api.pinboard.in/v1/"
requests.get(pinboard_url)
def get_all_posts():
posts = f"posts/all?auth_token={pinboard_token}"
pinboard_url = pinboard_base_url + posts
return requests.get(pinboard_url)

Loading…
Cancel
Save