diff --git a/README.md b/README.md index b07b27a..2d2c55d 100644 --- a/README.md +++ b/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. diff --git a/pinboard.py b/pinboard.py index a12c5b9..dcf6f04 100644 --- a/pinboard.py +++ b/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) +