Advertisement
hakegawa

Untitled

Jul 10th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. import requests
  2. import unittest
  3.  
  4.  
  5. class CheckUrl(unittest.TestCase):
  6. def check_url(self, url):
  7. r = requests.get(url, timeout=30)
  8. sc = r.status_code
  9. if sc == 200:
  10. pass
  11. else:
  12. raise Exception('Expect status code {}, get {}'.format(200, sc))
  13.  
  14. def test_main_page(self):
  15. url = 'https://news.rambler.ru/'
  16.  
  17. self.check_url(url)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement