2
2
from config import API_TOKEN
3
3
import pprint
4
4
5
+
6
+ print "Calling article API endpoint on the url: http://shichuan.github.io/javascript-patterns/...\n "
5
7
diffbot = DiffbotClient ()
6
- url = "http://shichuan.github.io/javascript-patterns/"
7
8
token = API_TOKEN
8
- api = "article"
9
9
version = 2
10
-
11
- print "Calling article API endpoint on the url: http://shichuan.github.io/javascript-patterns/... \n "
10
+ url = "http://shichuan.github.io/javascript-patterns/"
11
+ api = " article"
12
12
response = diffbot .request (url , token , api , version = 2 )
13
13
print "\n Printing response:\n "
14
14
pp = pprint .PrettyPrinter (indent = 4 )
15
15
print pp .pprint (response )
16
16
17
+ print
17
18
print "Calling article API endpoint with fields specified on the url: http://shichuan.github.io/javascript-patterns/...\n "
19
+ diffbot = DiffbotClient ()
20
+ token = API_TOKEN
21
+ version = 2
22
+ url = "http://shichuan.github.io/javascript-patterns/"
23
+ api = "article"
18
24
response = diffbot .request (url , token , api , fields = ['title' , 'type' ], version = 2 )
19
25
print "\n Printing response:\n "
20
26
pp = pprint .PrettyPrinter (indent = 4 )
21
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
45
+ version = 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 )
52
+
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 )
61
+ print "\n Printing response:\n "
62
+ pp = pprint .PrettyPrinter (indent = 4 )
63
+ print 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