From 1f84d1fe43c205f05839b058209b969acae6bbd4 Mon Sep 17 00:00:00 2001 From: Guanzhou Song Date: Fri, 8 Mar 2019 13:59:07 -0500 Subject: [PATCH] init --- config.py.example | 3 --- example.py | 5 ++++- main.py | 20 ++++++++++++++++++++ 3 files changed, 24 insertions(+), 4 deletions(-) delete mode 100644 config.py.example create mode 100644 main.py diff --git a/config.py.example b/config.py.example deleted file mode 100644 index c3c3028..0000000 --- a/config.py.example +++ /dev/null @@ -1,3 +0,0 @@ -# Add your API token here to run examples: - -API_TOKEN = "SOME_TOKEN" \ No newline at end of file diff --git a/example.py b/example.py index b7de9e6..ff7e2f1 100644 --- a/example.py +++ b/example.py @@ -80,4 +80,7 @@ pp = pprint.PrettyPrinter(indent=4) print pp.pprint(status) print "\nDeleting test crawl.\n" -diffbot.delete() \ No newline at end of file +diffbot.delete() + + + diff --git a/main.py b/main.py new file mode 100644 index 0000000..5b5b83c --- /dev/null +++ b/main.py @@ -0,0 +1,20 @@ +from client import DiffbotClient, DiffbotCrawl +from config import API_TOKEN +import pprint +import time +import json + + +def main(): + diffbot = DiffbotClient() + token = API_TOKEN + url = "https://newtonfreelibrary.libcal.com/event/4924168" + api = "product" + response = diffbot.request(url, token, api) + print response + print type(response) + print response["objects"][0]["title"] + + +if __name__ == '__main__': + main()