2013-11-29 19:46:39 +00:00
|
|
|
import random
|
|
|
|
import requests
|
|
|
|
|
|
|
|
urls = [
|
2013-11-30 12:10:49 +00:00
|
|
|
'https://node-hnapi.herokuapp.com/'
|
2013-11-29 19:46:39 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
class HackerNews:
|
|
|
|
@staticmethod
|
|
|
|
def getHomePage():
|
|
|
|
random.shuffle(urls)
|
|
|
|
for i in urls:
|
|
|
|
r = requests.get(i+"news")
|
|
|
|
try:
|
|
|
|
return r.json()
|
|
|
|
except ValueError:
|
2013-11-30 11:53:03 +00:00
|
|
|
continue;
|