wuvt / wuvt-site

Website including a CMS, playlist information, and donation management tools
https://www.wuvt.vt.edu
GNU Affero General Public License v3.0
11 stars 12 forks source link

New version of Stripe breaks /donate/missioncontrol endpoint (and possible other donation endpoints) #352

Closed g-i-g closed 5 years ago

g-i-g commented 5 years ago

From the email log:

> Message type:       ERROR
> Time:               2018-10-24 21:23:41,761
>
> Exception on /donate/missioncontrol [GET]
> Traceback (most recent call last):
>   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2292, in wsgi_app
>     response = self.full_dispatch_request()
>   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1815, in full_dispatch_request
>     rv = self.handle_user_exception(e)
>   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1718, in handle_user_exception
>     reraise(exc_type, exc_value, tb)
>   File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 35, in reraise
>     raise value
>   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1813, in full_dispatch_request
>     rv = self.dispatch_request()
>   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1799, in dispatch_request
>     return self.view_functions[rule.endpoint](**req.view_args)
>   File "./wuvt/view_utils.py", line 32, in local_wrapper
>     return f(*args, **kwargs)
>   File "./wuvt/donate/views.py", line 171, in missioncontrol_index
>     plans=list_plans(), orders=orders,
>   File "./wuvt/donate/__init__.py", line 15, in list_plans
>     plans = stripe.Plan.all()['data']
> AttributeError: type object 'Plan' has no attribute 'all'

The latest version of Stripe does not have an all() method for stripe.Plan, but the version that this repo was using until then does:

[dws@refrigerator ~]$ sudo !!
sudo python3 -m pip install stripe==1.79.1
[sudo] password for dws: 
Collecting stripe==1.79.1
  Downloading https://files.pythonhosted.org/packages/8f/0d/66b4f533a22a7aac340f602cb54bdc74bf3507e3aba4026f129fe67470b2/stripe-1.79.1-py2.py3-none-any.whl (204kB)
    100% |████████████████████████████████| 215kB 5.8MB/s 
Requirement already satisfied: requests>=0.8.8 in /usr/lib/python3.7/site-packages (from stripe==1.79.1) (2.19.1)
Requirement already satisfied: chardet>=3.0.2 in /usr/lib/python3.7/site-packages (from requests>=0.8.8->stripe==1.79.1) (3.0.4)
Requirement already satisfied: idna>=2.5 in /usr/lib/python3.7/site-packages (from requests>=0.8.8->stripe==1.79.1) (2.7)
Requirement already satisfied: urllib3>=1.21.1 in /usr/lib/python3.7/site-packages (from requests>=0.8.8->stripe==1.79.1) (1.23)
Installing collected packages: stripe
  Found existing installation: stripe 2.8.0
    Uninstalling stripe-2.8.0:
      Successfully uninstalled stripe-2.8.0
Successfully installed stripe-1.79.1
[dws@refrigerator ~]$ python3
Python 3.7.0 (default, Jul 15 2018, 10:44:58) 
[GCC 8.1.1 20180531] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import stripe
>>> "all" in dir(stripe.Plan)
True
>>> 
[dws@refrigerator ~]$ sudo python3 -m pip install stripe==2.10.1
Collecting stripe==2.10.1
  Using cached https://files.pythonhosted.org/packages/72/53/82afa463fbff51d0148bb5fd41c75cf258efc5b94614899d756483160bbd/stripe-2.10.1-py2.py3-none-any.whl
Requirement already satisfied: requests>=2; python_version >= "3.0" in /usr/lib/python3.7/site-packages (from stripe==2.10.1) (2.19.1)
Requirement already satisfied: chardet>=3.0.2 in /usr/lib/python3.7/site-packages (from requests>=2; python_version >= "3.0"->stripe==2.10.1) (3.0.4)
Requirement already satisfied: idna>=2.5 in /usr/lib/python3.7/site-packages (from requests>=2; python_version >= "3.0"->stripe==2.10.1) (2.7)
Requirement already satisfied: urllib3>=1.21.1 in /usr/lib/python3.7/site-packages (from requests>=2; python_version >= "3.0"->stripe==2.10.1) (1.23)
Installing collected packages: stripe
  Found existing installation: stripe 1.79.1
    Uninstalling stripe-1.79.1:
      Successfully uninstalled stripe-1.79.1
Successfully installed stripe-2.10.1
[dws@refrigerator ~]$ python3
Python 3.7.0 (default, Jul 15 2018, 10:44:58) 
[GCC 8.1.1 20180531] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import stripe
>>> "all" in dir(stripe.Plan)
False

While it's probably not ideal to use an older version of something critical like Stripe, it's a quickfix that can be applied in time for radiothon until we find out how to work with the newer Python implementation of their API.

g-i-g commented 5 years ago

See pull request #353

g-i-g commented 5 years ago

Merged