Advertisement
hakegawa

Untitled

Aug 9th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import requests
  4.  
  5.  
  6. class CheckUrl(object):
  7. OLD_API_URLS = ['http://api.news.rambler.ru/newapi/fast/rambler/head/',
  8. 'http://api.news.rambler.ru/newapi/fast/rambler/ukraine/',
  9. 'http://api.news.rambler.ru/newapi/fast/rambler/moscow_city/',
  10. 'http://api.news.rambler.ru/newapi/fast/rambler/politics/',
  11. 'http://api.news.rambler.ru/newapi/fast/rambler/sport/',
  12. 'http://api.news.rambler.ru/newapi/fast/rambler/incidents/',
  13. 'http://api.news.rambler.ru/newapi/fast/rambler/auto/',
  14. 'http://api.news.rambler.ru/newapi/fast/rambler/scitech/',
  15. 'http://api.news.rambler.ru/newapi/fast/rambler/games/',
  16. 'http://api.news.rambler.ru/newapi/fast/rambler/business/',
  17. 'http://api.news.rambler.ru/newapi/fast/rambler/lifestyle/',
  18. 'http://api.news.rambler.ru/newapi/fast/rambler/health/',
  19. 'http://api.news.rambler.ru/newapi/fast/rambler/starlife/']
  20.  
  21. NEW_API_URLS = ['http://coolstream.rambler.ru/top/clusters/comments']
  22.  
  23. def check_url(self):
  24. urls = self.OLD_API_URLS + self.NEW_API_URLS
  25. for url in urls:
  26. r = requests.get(url, timeout=30)
  27. sc = r.status_code
  28. assert sc == 200, 'Url: {} return status code: {}'.format(url, sc)
  29.  
  30. if __name__ == '__main__':
  31. c = CheckUrl()
  32. c.check_url()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement