#Raghavendra-stripe-proxy

1 messages ยท Page 1 of 1 (latest)

silent mesa
#

hello

weak estuary
#

Hi hmunzo

#

I am using python : to access stripe data as below:

#

import stripe

#Set Proxy
stripe.proxy = "http://webgateway.itm.mcafee.com:9090"
stripe.api_version = "2022-08-01"

#Function to fetch Customer ID

Use Stripe's library to make requests

def stripeCheckSubscription():
#stripe.proxy = "http://webgateway.itm.mcafee.com:9090"
vEmail = 'test1@mcafee.com'
vCustID = ""
stripe.api_key = "sk_tesoxcUZIqDJx4zSbi"
vCustomerDetails = stripe.Customer.list(email=vEmail)
for cust in vCustomerDetails:
vCustID = cust.id
if (vCustID):
result = "1"
vstripeSub = stripe.Subscription.list(limit=3, status='canceled', customer=vCustID)
for i, Sub in enumerate(vstripeSub):
if i == 0:
if (Sub.status == "canceled"):
result = result+"0"
return result
break
else:
result = result+"1"
return result
break
else:
result = "00"
return result

#

i am getting user warning as below:

#

ers\rrao3\PycharmProjects\pythonProject\venv\Scripts\python.exe E:/Installations/Python/Lib/site-packages/StripeCheck.py
E:\Installations\Python\Lib\site-packages\stripe\api_requestor.py:93: UserWarning: stripe.proxy was updated after sending a request - this is a no-op. To use a different proxy, set stripe.default_http_client to a new client configured with the proxy.
warnings.warn(

#

please help

silent mesa
#

give me a bit

weak estuary
#

sure take your time

#

๐Ÿ‘

silent mesa
#

you shared your test mode secret key there, can you please remove that sk_test_123 ID from the above message pls?

weak estuary
#

yes its not the complete id i have removed few characters in them

silent mesa
#

can you add log lines in your code to just before you are setting proxy anywhere and see which line of code it is giving you that warning on?

I imagine you're setting proxy = ... multiple times in your code somewhere

weak estuary
#

sure but i am setting the proxy only once

#

could you please help

silent mesa
#

I am helping

#

I'm asking if you can add log lines to your code

#

so we can trace exactly what is happening just before you get the warning

weak estuary
#

yes its because i am calling customer & subscription in one function

#

as i could see

#

if i call in different i wont get this warning ๐Ÿ˜ฆ

silent mesa
#

yeah sorry I'm still unclear on what you mean by those last few statements.

But ultimately, your code is re-setting proxy after making requests to Stripe and adding additional logging will help you uncover where

#

that is how I would approach it

weak estuary
#

oh ok

#

thanks its fixed. Thanks a lot for your time

#

๐Ÿ™‚