@@ -547,20 +547,13 @@ def _perform_urllib_http_request(
547547 # which might be a security risk if the URL to open can be manipulated by an external user.
548548 if url .lower ().startswith ("http" ):
549549 req = Request (method = "POST" , url = url , data = body , headers = headers )
550- resp : HTTPResponse = urlopen (req )
550+ resp : HTTPResponse = urlopen (req , context = self . ssl )
551551 charset = resp .headers .get_content_charset ()
552552 body : str = resp .read ().decode (charset ) # read the response body here
553- return {
554- "status" : resp .code ,
555- "headers" : resp .headers ,
556- "body" : body ,
557- }
553+ return {"status" : resp .code , "headers" : resp .headers , "body" : body }
558554 raise SlackRequestError (f"Invalid URL detected: { url } " )
559555 except HTTPError as e :
560- resp = {
561- "status" : e .code ,
562- "headers" : e .headers ,
563- }
556+ resp = {"status" : e .code , "headers" : e .headers }
564557 if e .code == 429 :
565558 # for compatibility with aiohttp
566559 resp ["headers" ]["Retry-After" ] = resp ["headers" ]["retry-after" ]
@@ -575,7 +568,7 @@ def _perform_urllib_http_request(
575568 raise err
576569
577570 def _build_urllib_request_headers (
578- self , token : str , has_json : bool , has_files : bool , additional_headers : dict ,
571+ self , token : str , has_json : bool , has_files : bool , additional_headers : dict
579572 ):
580573 headers = {
581574 "User-Agent" : get_user_agent (),
0 commit comments