Last active
December 22, 2018 18:50
-
-
Save dojutsu-user/e74e2db29a73e26cf77f5b5cc7ad4e72 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from requests.exceptions import ConnectionError | |
def get_response(link): | |
"""Make a GET request to the link | |
:param link: Valid HTTP/HTTPS link | |
:type link: str | |
:returns A response object | |
:rtype: requests.models.Response | |
:raises: ConnectionError: If there is some problem in connecting to the link | |
""" | |
try: | |
response = requests.get(link) | |
return response | |
except ConnectionError as e: | |
print('Connection Error') | |
print(e) | |
sys.exit(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment