def test_authorize_url(self, request_mock): url = stripe.OAuth.authorize_url( scope="read_write", state="csrf_token", stripe_user={ "email": "*****@*****.**", "url": "https://example.com/profile/test", "country": "US", }, ) o = urlparse(url) params = parse_qs(o.query) url_express = stripe.OAuth.authorize_url( express=True, scope="read_write", state="csrf_token" ) o_express = urlparse(url_express) assert o.scheme == "https" assert o.netloc == "connect.stripe.com" assert o.path == "/oauth/authorize" assert o_express.path == "/express/oauth/authorize" assert params["client_id"] == ["ca_123"] assert params["scope"] == ["read_write"] assert params["stripe_user[email]"] == ["*****@*****.**"] assert params["stripe_user[url]"] == [ "https://example.com/profile/test" ] assert params["stripe_user[country]"] == ["US"]
def __init__(self, verify_ssl_certs=True, proxy=None): super(PycurlClient, self).__init__(verify_ssl_certs=verify_ssl_certs, proxy=proxy) # Initialize this within the object so that we can reuse connections. self._curl = pycurl.Curl() # need to urlparse the proxy, since PyCurl # consumes the proxy url in small pieces if self._proxy: # now that we have the parser, get the proxy url pieces proxy = self._proxy for scheme in proxy: proxy[scheme] = urlparse(proxy[scheme])
def __init__(self, verify_ssl_certs=True, proxy=None): super(PycurlClient, self).__init__( verify_ssl_certs=verify_ssl_certs, proxy=proxy) # Initialize this within the object so that we can reuse connections. self._curl = pycurl.Curl() # need to urlparse the proxy, since PyCurl # consumes the proxy url in small pieces if self._proxy: # now that we have the parser, get the proxy url pieces proxy = self._proxy for scheme in proxy: proxy[scheme] = urlparse(proxy[scheme])