






import pytest
import requests

from datasets.utils.file_utils import http_head

from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline






@pytest.mark.integration
def      _snake_case     ():
   with offline(OfflineSimulationMode.CONNECTION_TIMES_OUT):
      with pytest.raises(__lowercase):
         requests.request('GET'     ,   'https://huggingface.co')
      with pytest.raises(requests.exceptions.ConnectTimeout):
         requests.request('GET'     ,   'https://huggingface.co'     ,   timeout=1.0)






@pytest.mark.integration
def      _snake_case     ():
   with offline(OfflineSimulationMode.CONNECTION_FAILS):
      with pytest.raises(requests.exceptions.ConnectionError):
         requests.request('GET'     ,   'https://huggingface.co')






def      _snake_case     ():
   with offline(OfflineSimulationMode.HF_DATASETS_OFFLINE_SET_TO_1):
      with pytest.raises(__lowercase):
         http_head('https://huggingface.co')













import requests






def      _snake_case     (__lowercase     ,   __lowercase):
   UpperCamelCase_						=  {'Content-Type': 'application/json'}
   UpperCamelCase_						=  requests.post(__lowercase     ,   json={'text': message_body}     ,   headers=__lowercase)
   if response.status_code != 200:
      UpperCamelCase_						=  (
          'Request to slack returned an error '
          f"""{response.status_code}, the response is:\n{response.text}"""
      )
      raise ValueError(__lowercase)


if __name__ == "__main__":
 # Set the slack url to the one provided by Slack when you create the webhook at
 # https://my.slack.com/services/new/incoming-webhook/
 send_slack_message("""<YOUR MESSAGE BODY>""", """<SLACK CHANNEL URL>""")





