Beispiel #1
0
    def test_url_param_get(self):
        u = 'http://test.com/?foo=bar&abc=def&z=1'

        # Get foo
        self.assertEqual(url_get_query_param(u, 'foo'), 'bar')

        # Get non existent parameter
        self.assertRaises(KeyError, url_get_query_param, u, 'xxxx')
Beispiel #2
0
 def get_next_url(self, url):
     """
     Generates URLs for the current website
     """
     npage = int(url_get_query_param(url, 'page', '0'))
     url = url_strip_query_param(url, 'page')
     if url.find('?') == -1:
         url += '?'
     return "{0}&page={1}".format(url, npage + 1)