'plaid error when using request with a jquery post

Getting python error when using the plaid python quickstart library

    @app.route('/set_access_token', methods=['POST'])
    def get_access_token():
    global access_token
    global item_id
    global transfer_id
    public_token = request.form['public_token']
    try:
    exchange_request = ItemPublicTokenExchangeRequest(
    public_token=public_token)
    exchange_response = client.item_public_token_exchange(exchange_request)
    access_token = exchange_response['access_token']
    item_id = exchange_response['item_id']
    print(exchange_response)
    if 'transfer' in PLAID_PRODUCTS:
    transfer_id = authorize_and_create_transfer(access_token)
    return jsonify(exchange_response.to_dict())
    except plaid.ApiException as e:
    return json.loads(e.body)

when the above is called getting the following traceback

    Traceback (most recent call last):
    File "C:\Users\Michael\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\app.py", line 2095, in __call__
    return self.wsgi_app(environ, start_response)
    File "C:\Users\Michael\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\app.py", line 2080, in wsgi_app
    response = self.handle_exception(e)
    File "C:\Users\Michael\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\app.py", line 2077, in wsgi_app
    response = self.full_dispatch_request()
    File "C:\Users\Michael\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\app.py", line 1525, in full_dispatch_request
    rv = self.handle_user_exception(e)
    File "C:\Users\Michael\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\app.py", line 1523, in full_dispatch_request
    rv = self.dispatch_request()
    File "C:\Users\Michael\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\app.py", line 1509, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
    File "C:\Budgetary\server.py", line 207, in get_access_token
    public_token = request.form['public_token']
    File "C:\Users\Michael\AppData\Local\Programs\Python\Python310\lib\site-packages\plaid\model_utils.py", line 169, in __getattr__
    return self.__getitem__(attr)
    File "C:\Users\Michael\AppData\Local\Programs\Python\Python310\lib\site-packages\plaid\model_utils.py", line 364, in __getitem__
    raise ApiAttributeError(
    plaid.exceptions.ApiAttributeError: LinkTokenCreateRequest has no attribute 'form' at ['form']

the request definition is not working with the plaid python library in my build of flask. Anyone have a fix to this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source