Ejemplo n.º 1
0
    def test_no_double_escaping_existing_params(self):
        url = 'http://a.com?a=%C4%A9'
        self.assertEquals('http://a.com?a=%C4%A9&c=d',
                          ops.update_query_params(url, {'c': 'd'}))

        url = 'http://a.com?a=my+val'
        self.assertEquals('http://a.com?a=my+val&c=d',
                          ops.update_query_params(url, {'c': 'd'}))
Ejemplo n.º 2
0
    def test_update_query_params(self):
        url = u'http://a.com?a=b'
        self.assertEquals('http://a.com?a=b', ops.update_query_params(url, {}))
        self.assertEquals('http://a.com?a=c', ops.update_query_params(url, ('a', 'c')))
        self.assertEquals('http://a.com?a=b&c=d', ops.update_query_params(url, {'c': 'd'}))
        self.assertEquals('http://a.com?a=%C4%A9', ops.update_query_params(url, {'a': '\xc4\xa9'}))

        url = u'http://a.com/path?a=b'
        self.assertEquals('http://a.com/path?a=c', ops.update_query_params(url, {'a': 'c'}))
Ejemplo n.º 3
0
    def test_update_query_params(self):
        url = u'http://a.com?a=b'
        self.assertEquals('http://a.com?a=b', ops.update_query_params(url, {}))
        self.assertEquals('http://a.com?a=c',
                          ops.update_query_params(url, ('a', 'c')))
        self.assertEquals('http://a.com?a=b&c=d',
                          ops.update_query_params(url, {'c': 'd'}))
        self.assertEquals('http://a.com?a=%C4%A9',
                          ops.update_query_params(url, {'a': '\xc4\xa9'}))

        url = u'http://a.com/path?a=b'
        self.assertEquals('http://a.com/path?a=c',
                          ops.update_query_params(url, {'a': 'c'}))
Ejemplo n.º 4
0
 def __call__(self, **params):
     """Read the current URL, and JSON-decode the results."""
     
     if self.access_token:
         params['access_token'] = self.access_token
     url = update_query_params(self.url, params)
     data = json.loads(self.fetch(url,
                                  timeout=self.timeout,
                                  retries=self.retries, 
                                  urllib2=self.urllib2,
                                  httplib=self.httplib))
     return self.node(data, params)
Ejemplo n.º 5
0
    def call_fb(self, **params):
        """Read the current URL, and JSON-decode the results."""

        if self.access_token:
            params['access_token'] = self.access_token
        url = update_query_params(self.url, params)
        data = json.loads(
            self.fetch(url,
                       timeout=self.timeout,
                       retries=self.retries,
                       urllib2=self.urllib2,
                       httplib=self.httplib))
        return self.process_response(data, params)
Ejemplo n.º 6
0
    def call_fb(self, **params):
        """Read the current URL, and JSON-decode the results."""

        if self.access_token:
            params['access_token'] = self.access_token
        url = update_query_params(self.url, params)
        try:
            data = json.loads(self.fetch(url,
                                         timeout=self.timeout,
                                         retries=self.retries,
                                         urllib2=self.urllib2,
                                         httplib=self.httplib))
        except ValueError:
            msg = u'Failed to parse facebook response'
            raise GraphException(0, msg, graph=self, params=params)
        else:
            return self.process_response(data, params)
Ejemplo n.º 7
0
    def test_no_double_escaping_existing_params(self):
        url = 'http://a.com?a=%C4%A9'
        self.assertEquals('http://a.com?a=%C4%A9&c=d', ops.update_query_params(url, {'c': 'd'}))

        url = 'http://a.com?a=my+val'
        self.assertEquals('http://a.com?a=my+val&c=d', ops.update_query_params(url, {'c': 'd'}))
Ejemplo n.º 8
0
 def __or__(self, params):
     return self.copy(url=update_query_params(self.url, params))
Ejemplo n.º 9
0
 def with_url_params(self, param, val):
     """
         this used to overload the bitwise OR op
     """
     return self.copy(url=update_query_params(self.url, (param, val)))
Ejemplo n.º 10
0
 def with_url_params(self, param, val):
     """
         this used to overload the bitwise OR op
     """
     return self.copy(url=update_query_params(self.url, (param, val)))