hackertray/hackertray/hackernews.py
2013-12-12 23:38:31 +02:00

18 lines
340 B
Python

import random
import requests
urls = [
'https://node-hnapi.herokuapp.com/'
]
class HackerNews:
@staticmethod
def getHomePage():
random.shuffle(urls)
for i in urls:
r = requests.get(i + "news")
try:
return r.json()
except ValueError:
continue