Skip to content

Instantly share code, notes, and snippets.

@dojutsu-user
Last active December 22, 2018 18:50
Show Gist options
  • Save dojutsu-user/e74e2db29a73e26cf77f5b5cc7ad4e72 to your computer and use it in GitHub Desktop.
Save dojutsu-user/e74e2db29a73e26cf77f5b5cc7ad4e72 to your computer and use it in GitHub Desktop.
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