Skip to content

Commit 1bf7ea7

Browse files
committed
update to python 3
1 parent 4b9e2fa commit 1bf7ea7

3 files changed

Lines changed: 29 additions & 29 deletions

File tree

client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def request(self,params):
4141
try:
4242
return response.json()
4343
except:
44-
print response.text
44+
print(response.text)
4545

4646
def start(self,params):
4747
response = self.request(params)

example.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,81 +3,81 @@
33
import pprint
44
import time
55

6-
print "Calling article API endpoint on the url: http://shichuan.github.io/javascript-patterns/...\n"
6+
print("Calling article API endpoint on the url: http://shichuan.github.io/javascript-patterns/...\n")
77
diffbot = DiffbotClient()
88
token = API_TOKEN
99
url = "http://shichuan.github.io/javascript-patterns/"
1010
api = "article"
1111
response = diffbot.request(url, token, api)
12-
print "\nPrinting response:\n"
12+
print("\nPrinting response:\n")
1313
pp = pprint.PrettyPrinter(indent=4)
14-
print pp.pprint(response)
14+
print(pp.pprint(response))
1515

16-
print
17-
print "Calling article API endpoint with fields specified on the url: http://shichuan.github.io/javascript-patterns/...\n"
16+
print()
17+
print("Calling article API endpoint with fields specified on the url: http://shichuan.github.io/javascript-patterns/...\n")
1818
diffbot = DiffbotClient()
1919
token = API_TOKEN
2020
url = "http://shichuan.github.io/javascript-patterns/"
2121
api = "article"
2222
response = diffbot.request(url, token, api, fields=['title', 'type'])
23-
print "\nPrinting response:\n"
23+
print("\nPrinting response:\n")
2424
pp = pprint.PrettyPrinter(indent=4)
25-
print pp.pprint(response)
25+
print(pp.pprint(response))
2626

27-
print
28-
print "Calling frontpage API endpoint on the url: http://www.huffingtonpost.com/...\n"
27+
print()
28+
print("Calling frontpage API endpoint on the url: http://www.huffingtonpost.com/...\n")
2929
diffbot = DiffbotClient()
3030
token = API_TOKEN
3131
url = "http://www.huffingtonpost.com/"
3232
api = "frontpage"
3333
response = diffbot.request(url, token, api)
34-
print "\nPrinting response:\n"
34+
print("\nPrinting response:\n")
3535
pp = pprint.PrettyPrinter(indent=4)
36-
print pp.pprint(response)
36+
print(pp.pprint(response))
3737

38-
print
39-
print "Calling product API endpoint on the url: http://www.overstock.com/Home-Garden/iRobot-650-Roomba-Vacuuming-Robot/7886009/product.html...\n"
38+
print()
39+
print("Calling product API endpoint on the url: http://www.overstock.com/Home-Garden/iRobot-650-Roomba-Vacuuming-Robot/7886009/product.html...\n")
4040
diffbot = DiffbotClient()
4141
token = API_TOKEN
4242
url = "http://www.overstock.com/Home-Garden/iRobot-650-Roomba-Vacuuming-Robot/7886009/product.html"
4343
api = "product"
4444
response = diffbot.request(url, token, api)
45-
print "\nPrinting response:\n"
45+
print("\nPrinting response:\n")
4646
pp = pprint.PrettyPrinter(indent=4)
47-
print pp.pprint(response)
47+
print(pp.pprint(response))
4848

49-
print
50-
print "Calling image API endpoint on the url: http://www.google.com/...\n"
49+
print()
50+
print("Calling image API endpoint on the url: http://www.google.com/...\n")
5151
diffbot = DiffbotClient()
5252
token = API_TOKEN
5353
url = "http://www.google.com/"
5454
api = "image"
5555
response = diffbot.request(url, token, api)
56-
print "\nPrinting response:\n"
56+
print("\nPrinting response:\n")
5757
pp = pprint.PrettyPrinter(indent=4)
58-
print pp.pprint(response)
58+
print(pp.pprint(response))
5959

60-
print
61-
print "Calling classifier API endpoint on the url: http://www.twitter.com/...\n"
60+
print()
61+
print("Calling classifier API endpoint on the url: http://www.twitter.com/...\n")
6262
diffbot = DiffbotClient()
6363
token = API_TOKEN
6464
url = "http://www.twitter.com/"
6565
api = "analyze"
6666
response = diffbot.request(url, token, api)
67-
print "\nPrinting response:\n"
67+
print("\nPrinting response:\n")
6868
pp = pprint.PrettyPrinter(indent=4)
69-
print pp.pprint(response)
69+
print(pp.pprint(response))
7070

71-
print "Create a new crawl of http://support.diffbot.com/ using the Article API...\n"
71+
print("Create a new crawl of http://support.diffbot.com/ using the Article API...\n")
7272
token = API_TOKEN
7373
seeds = "http://support.diffbot.com"
7474
api = "article"
7575
name = "testCrawl"
7676
diffbot = DiffbotCrawl(token, name, seeds=seeds, api=api)
7777
time.sleep(5)
7878
status = diffbot.status()
79-
print "\nPrinting status:\n"
79+
print("\nPrinting status:\n")
8080
pp = pprint.PrettyPrinter(indent=4)
81-
print pp.pprint(status)
82-
print "\nDeleting test crawl.\n"
81+
print(pp.pprint(status))
82+
print("\nDeleting test crawl.\n")
8383
diffbot.delete()

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
requests==2.1.0
1+
requests==2.31.0

0 commit comments

Comments
 (0)