#monobot-python-subscription

1 messages · Page 1 of 1 (latest)

severe dew
#

Hi there 👋 does this error persist if you use a newer version of our Python library?

distant dragon
#

Thanks Toby
Well ... upgrade library is always a workload.
Your recomendation is then upgrade version only?

#

I have a follow up question:
I would also like to modify the end of subscription datetime
How is that archieved?

severe dew
#

I'm not sure whether updating versions is the right approach, but I was trying to get a feel for what troubleshooting you'd done.

#

In the code above, subscription_id is holding a string, correct?

distant dragon
#

yes

#
/var/www/sanctions/env/lib/python3.8/site-packages/stripe/api_resources/abstract/updateable_api_resource.py in modify(cls, sid, **params)
      9     @classmethod
     10     def modify(cls, sid, **params):
---> 11         url = "%s/%s" % (cls.class_url(), quote_plus(util.utf8(sid)))
     12         return cls._static_request("post", url, **params)
     13 

/usr/local/lib/python3.8/urllib/parse.py in quote_plus(string, safe, encoding, errors)
    853     else:
    854         space = b' '
--> 855     string = quote(string, safe + space, encoding, errors)
    856     return string.replace(' ', '+')
    857 

/usr/local/lib/python3.8/urllib/parse.py in quote(string, safe, encoding, errors)
    837         if errors is not None:
    838             raise TypeError("quote() doesn't support 'errors' for bytes")
--> 839     return quote_from_bytes(string, safe)
    840 
    841 def quote_plus(string, safe='', encoding=None, errors=None):

/usr/local/lib/python3.8/urllib/parse.py in quote_from_bytes(bs, safe)
    862     """
    863     if not isinstance(bs, (bytes, bytearray)):
--> 864         raise TypeError("quote_from_bytes() expected bytes")
    865     if not bs:
    866         return ''
#

complete tracelog

sterile carbon
#

You might want to check that again. I am getting your exact error when I pass a non-string in for the subscription ID but passing in an incorrect string gets a different error.

distant dragon
#

ok, will double check, thanks for your support.

I would also like to modify the end of subscription datetime
How is that archieved?

sterile carbon
#

Can you explain what you mean by "the end of subscription datetime" here? What subscription timestamp are you looking to change?

distant dragon
#

Yes I am modifying a subscription, but with that change I will also want to modify when that subscription is autorenewed

sterile carbon
#

The billing cycle anchor is the way to do that. You are trying to modify the correct value here. The subscription renews the same day of every month

#

So if you set the billing cycle anchor to today, that subscription would renew on the 11th of every month

distant dragon
#

Ours are anual subscriptions, so when I do
stripe.Subscription.modify(subscription_id, billing_cycle_anchor="now", proration_behavior="none")
How do I modify that subscription so its one year from the date I modify it?

#

btw thanks @severe dew and @sterile carbon

#

oh, now I understand ... so that parameter billing_cycle_anchor already does that.
again thanks @sterile carbon
You can consider this ticket closed.
❤️

sterile carbon
#

Awesome! Glad we could help

distant dragon
#

🎩