- have still have to figure out how to /parse/ the json file - still have to figure out how to post an item with argumentsmaster
parent
50cc781149
commit
298e11afb3
@ -1,13 +1,32 @@
|
|||||||
import requests
|
import json
|
||||||
import os
|
import os
|
||||||
|
import requests
|
||||||
import pysnooper
|
import pysnooper
|
||||||
|
|
||||||
|
|
||||||
pinboard_token = os.environ.get("PINBOARD_TOKEN")
|
pinboard_token = os.environ.get("PINBOARD_TOKEN")
|
||||||
pinboard_base_url = "https://api.pinboard.in/v1/"
|
pinboard_base_url = "https://api.pinboard.in/v1/"
|
||||||
|
|
||||||
def get_all_posts():
|
def get_all_posts():
|
||||||
posts = f"posts/all?auth_token={pinboard_token}"
|
get_post_snippet = f"posts/all?auth_token={pinboard_token}"
|
||||||
pinboard_url = pinboard_base_url + posts
|
pinboard_url = pinboard_base_url + posts_url_snippet
|
||||||
|
|
||||||
return requests.get(pinboard_url)
|
return requests.get(pinboard_url)
|
||||||
|
|
||||||
|
@pysnooper.snoop()
|
||||||
|
def add_pin_url(reddit_title, reddit_url, reddit_description, subreddit):
|
||||||
|
add_post_snippet = f"posts/add?auth_token={pinboard_token}"
|
||||||
|
args = {
|
||||||
|
'url': reddit_url,
|
||||||
|
'description': reddit_title,
|
||||||
|
'extended': reddit_description,
|
||||||
|
'tags': subreddit,
|
||||||
|
'replace': no
|
||||||
|
}
|
||||||
|
pass
|
||||||
|
|
||||||
|
def import_reddit_url_from_file(filename):
|
||||||
|
with open(filename, 'r') as infile:
|
||||||
|
json.load(infile)
|
||||||
|
|
||||||
|
import_reddit_url_from_file("data.json")
|
||||||
|
Loading…
Reference in new issue