Exemplo n.º 1
0
    def new_session(self):
        """Generate a new session.

        :returns:
            A brand new session
        :rtype:
            :class:`~github3.session.GitHubSession`
        """
        return session.GitHubSession()
Exemplo n.º 2
0
 def test_custom_timeout(self, request_mock):
     """Test that custom timeout values are used"""
     response = mock.Mock()
     response.configure_mock(status_code=200, headers={})
     request_mock.return_value = response
     s = session.GitHubSession(default_connect_timeout=300,
                               default_read_timeout=400)
     r = s.get("http://example.com")
     assert r is response
     request_mock.assert_called_once_with("GET",
                                          "http://example.com",
                                          allow_redirects=True,
                                          timeout=(300, 400))
Exemplo n.º 3
0
 def build_session(self, base_url=None):
     s = session.GitHubSession()
     if base_url:
         s.base_url = base_url
     return s