MCPcopy Index your code
hub / github.com/PyGithub/PyGithub / __customConnection

Method __customConnection

github/Requester.py:905–934  ·  view source on GitHub ↗
(self, url: str)

Source from the content-addressed store, hash-verified

903 assert self.__hostnameHasDomain(o.hostname, self.__domains), o.hostname
904
905 def __customConnection(self, url: str) -> HTTPRequestsConnectionClass | HTTPSRequestsConnectionClass | None:
906 cnx: HTTPRequestsConnectionClass | HTTPSRequestsConnectionClass | None = None
907 if not url.startswith("/"):
908 # check URL is allowed
909 self.__assertUrlAllowed(url)
910
911 # only return connection if url deviates from base_url
912 o = urllib.parse.urlparse(url)
913 if (
914 o.hostname != self.__hostname
915 or (o.port and o.port != self.__port)
916 or (o.scheme != self.__scheme and not (o.scheme == "https" and self.__scheme == "http"))
917 ): # issue80
918 if o.scheme == "http":
919 cnx = self.__httpConnectionClass(
920 o.hostname, # type: ignore
921 o.port,
922 retry=self.__retry,
923 pool_size=self.__pool_size,
924 )
925 self.__custom_connections.append(cnx)
926 elif o.scheme == "https":
927 cnx = self.__httpsConnectionClass(
928 o.hostname, # type: ignore
929 o.port,
930 retry=self.__retry,
931 pool_size=self.__pool_size,
932 )
933 self.__custom_connections.append(cnx)
934 return cnx
935
936 @classmethod
937 def createException(

Callers 5

requestJsonAndCheckMethod · 0.95
requestBlobAndCheckMethod · 0.95
__requestRawMethod · 0.95

Calls 1

__assertUrlAllowedMethod · 0.95

Tested by

no test coverage detected