Esempio n. 1
0
 def __init__(self, base_url, session=None):
     """
     :param str base_url: the URL of the Gitea server to communicate with. Should be given
                          with the https protocol
     :param requests.Session session: a ``requests`` session instance
     """
     api_base = append_url(base_url, "/api/v1/")
     self._requestor = RelativeHttpRequestor(api_base, session=session)
 def path(self, relative):
     return http_utils.append_url(self.api_endpoint, relative)
 def test_append_url1(self):
     base = "https://www.google.com/"
     path = "/images/"
     self.assertEqual(http_utils.append_url(base, path),
                      "https://www.google.com/images/")
 def test_append_url3(self):
     base = "https://hello.org/dir1/dir2"
     path = "/dir3/file.txt"
     self.assertEqual(http_utils.append_url(base, path),
                      "https://hello.org/dir1/dir2/dir3/file.txt")
 def test_append_url2(self):
     base = "http://www.hello.world.net"
     path = "great/api/v1"
     self.assertEqual(http_utils.append_url(base, path),
                      "http://www.hello.world.net/great/api/v1")