personalcapital | Personal Capital library for accessing its API | REST library
kandi X-RAY | personalcapital Summary
kandi X-RAY | personalcapital Summary
Personal Capital library for accessing its API
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Fetch data from server
- Make a POST request
- Authenticate with username and password
- Identify a user
- Authenticate using the given password
- Gets the CSRF from the home page
- Load session from file
- Set session cookies
- Get the email address
- Get password
- Fetches a two - factor verification mode
- Generate challenge payload
- Gets a challenge email address
- Issues a Challenge SMS for the current user
- Authenticate using two factor verification mode
- Generate authentication payload
- Authenticates an email by code
- Authenticates SMS using the given code
- Save current session
- Returns the current session
- Authenticates a given password
personalcapital Key Features
personalcapital Examples and Code Snippets
Community Discussions
Trending Discussions on personalcapital
QUESTION
I have an API request to a third-party website that works great in the command line (from https://github.com/haochi/personalcapital):
...ANSWER
Answered 2018-Oct-26 at 01:36The error you are experiencing is actually due to the way you try to use global variables to persist state between requests. You initially define password as a module level variable and then set password = request.form.get("pc_password")
within your update function. Due to pythons rules regarding global and local variables https://docs.python.org/3/faq/programming.html#id9 this creates a new local variable containing the password value and leaves the module level variable untouched. You then access the original global password variable within your authenticate function which fails as this password variable is still set to its original value of ''. The quick fix would be to add global password
at the start of your update function but this ignores the other problems with this method of persisting state. All of your global variables are shared between everyone using your site, so that if multiple people are logged in then they will all be logged into the same personal capital account. It would be preferable to use the session object to persist this data as each user will then only be able to access their own session object and there will be no risk of people accessing each others accounts. Your use of the PersonalCapital object complicates things a little as this uses instance variables to persist state, which is appropriate for a command line application but less so for a web application. It is a very simple object however, with only 2 instance variables. It should therefore be fairly straightforward to extract these and store them in the session at the end of your update function and use these values to rebuild the object at the start of your authenticate function.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install personalcapital
You can use personalcapital like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page