forked from stripe/stripe-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxy.py
More file actions
37 lines (29 loc) · 879 Bytes
/
Copy pathproxy.py
File metadata and controls
37 lines (29 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from __future__ import absolute_import, division, print_function
import os
import stripe
stripe.api_key = os.environ.get("STRIPE_SECRET_KEY")
print("Attempting charge...")
proxy = {
"http": "http://<user>:<pass>@<proxy>:<port>",
"https": "http://<user>:<pass>@<proxy>:<port>",
}
clients = (
stripe.http_client.RequestsClient(
verify_ssl_certs=stripe.verify_ssl_certs, proxy=proxy
),
stripe.http_client.PycurlClient(
verify_ssl_certs=stripe.verify_ssl_certs, proxy=proxy
),
stripe.http_client.Urllib2Client(
verify_ssl_certs=stripe.verify_ssl_certs, proxy=proxy
),
)
for c in clients:
stripe.default_http_client = c
resp = stripe.Charge.create(
amount=200,
currency="usd",
card="tok_visa",
description="customer@gmail.com",
)
print("Success: %s, %r" % (c.name, resp))