22from config import API_TOKEN
33import pprint
44
5+
6+ print "Calling article API endpoint on the url: http://shichuan.github.io/javascript-patterns/...\n "
57diffbot = DiffbotClient ()
8+ token = API_TOKEN
9+ version = 2
610url = "http://shichuan.github.io/javascript-patterns/"
11+ api = "article"
12+ response = diffbot .request (url , token , api , version = 2 )
13+ print "\n Printing response:\n "
14+ pp = pprint .PrettyPrinter (indent = 4 )
15+ print pp .pprint (response )
16+
17+ print
18+ print "Calling article API endpoint with fields specified on the url: http://shichuan.github.io/javascript-patterns/...\n "
19+ diffbot = DiffbotClient ()
720token = API_TOKEN
21+ version = 2
22+ url = "http://shichuan.github.io/javascript-patterns/"
823api = "article"
24+ response = diffbot .request (url , token , api , fields = ['title' , 'type' ], version = 2 )
25+ print "\n Printing response:\n "
26+ pp = pprint .PrettyPrinter (indent = 4 )
27+ print pp .pprint (response )
28+
29+ print
30+ print "Calling frontpage API endpoint on the url: http://www.huffingtonpost.com/...\n "
31+ diffbot = DiffbotClient ()
32+ token = API_TOKEN
33+ version = 2
34+ url = "http://www.huffingtonpost.com/"
35+ api = "frontpage"
36+ response = diffbot .request (url , token , api , version = version )
37+ print "\n Printing response:\n "
38+ pp = pprint .PrettyPrinter (indent = 4 )
39+ print pp .pprint (response )
40+
41+ print
42+ print "Calling product API endpoint on the url: http://www.overstock.com/Home-Garden/iRobot-650-Roomba-Vacuuming-Robot/7886009/product.html...\n "
43+ diffbot = DiffbotClient ()
44+ token = API_TOKEN
945version = 2
46+ url = "http://www.overstock.com/Home-Garden/iRobot-650-Roomba-Vacuuming-Robot/7886009/product.html"
47+ api = "product"
48+ response = diffbot .request (url , token , api , version = version )
49+ print "\n Printing response:\n "
50+ pp = pprint .PrettyPrinter (indent = 4 )
51+ print pp .pprint (response )
1052
11- print "Calling article API endpoint on the url: http://shichuan.github.io/javascript-patterns/...\n "
12- response = diffbot .request (url , token , api , version = 2 )
53+ print
54+ print "Calling image API endpoint on the url: http://www.google.com/...\n "
55+ diffbot = DiffbotClient ()
56+ token = API_TOKEN
57+ version = 2
58+ url = "http://www.google.com/"
59+ api = "image"
60+ response = diffbot .request (url , token , api , version = version )
1361print "\n Printing response:\n "
1462pp = pprint .PrettyPrinter (indent = 4 )
1563print pp .pprint (response )
64+
65+ print
66+ print "Calling classifier API endpoint on the url: http://www.twitter.com/...\n "
67+ diffbot = DiffbotClient ()
68+ token = API_TOKEN
69+ version = 2
70+ url = "http://www.twitter.com/"
71+ api = "analyze"
72+ response = diffbot .request (url , token , api , version = version )
73+ print "\n Printing response:\n "
74+ pp = pprint .PrettyPrinter (indent = 4 )
75+ print pp .pprint (response )
0 commit comments