I want to login to stockcharts.com webpage and then play with something available to its users after logged in.
Here is what I tried:
from requests import session
payload = { 'form_Name': 'Login',
'zendesk_timestamp': '',
'redirect': '',
'form_UserID': 'XXXX@YYY.com',
'form_UserPassword': 'ZZZZ',
'form_RememberMe': ''
}
c = session()
this_url = 'https://stockcharts.com/scripts/php/dblogin.php'
c.post( this_url, data = payload )
request = c.get( 'http://stockcharts.com/h-hd/?GOOG' )
I then play with the fetched historical data.
I used spyder, and below are the error messages I got:
raise ConnectionError(e)
requests.exceptions.ConnectionError: HTTPSConnectionPool(
host = 'stockcharts.com', port = 443 ):
Max retries exceeded with url: /scripts/php/dblogin.php
( Caused by <class 'socket.error'>:
[Errno 104] Connection reset by peer )
I have been googling for its answer for a while, tried a few things like ( the code and title are actually "borrowed" from them )
How to use Python to login to a webpage and retrieve cookies for later usage?
Python login to webpage and get contents of session protected page
I just cannot make it work for me. I use Python for some time but I think I am still somehow new to such kind of programming.
could anyone help me out? appreciate your help a lot!!
JW