Comments (4)
This functionality would be very helpful. +1
from finviz.
I figured out how to obtain a cookie. But it does something weird to the scraper when you use it. My guess is because it's a different url. https://elite.finviz.com/screener.ashx
rather than https://finviz.com/screener.ashx
Here's my quick code to get the cookie header. That's as far as I got for now, I may come back later and work on this more.
def get_auth_header():
login_url = 'https://finviz.com/login_submit.ashx'
data = {
'email': os.environ['FINVIZ_USERNAME'],
'password': os.environ['FINVIZ_PASSWORD']
}
response = requests.post(url=login_url, data=data)
for history in response.history:
if history.cookies:
for c in history.cookies:
if c.name == '.ASPXAUTH':
return {
'Cookie': f'{c.name}={c.value}'
}
example response:
print(get_auth_header())
{'Cookie': '.ASPXAUTH=1DC9E157078115DB9255E990EADE49A7C730035DEACF4F71559FF28438C6E10F92050B5AF0D3EA580F62565D75A8A9B788A099A3913C194C234710B1052C7DD74F942398AC78773BA8E82D1DC9E1570789031A9CC43D91A6C003C2A57C00D3DA7F40101EC2D1E9C56DDD8AB3F27E408A69BFA770789031A9025EDA596A4E38501A5CE079DA092104E392AF0D3EA580F62565D75A'}
from finviz.
I figured out how to obtain a cookie. But it does something weird to the scraper when you use it. My guess is because it's a different url.
https://elite.finviz.com/screener.ashx
rather thanhttps://finviz.com/screener.ashx
Here's my quick code to get the cookie header. That's as far as I got for now, I may come back later and work on this more.def get_auth_header(): login_url = 'https://finviz.com/login_submit.ashx' data = { 'email': os.environ['FINVIZ_USERNAME'], 'password': os.environ['FINVIZ_PASSWORD'] } response = requests.post(url=login_url, data=data) for history in response.history: if history.cookies: for c in history.cookies: if c.name == '.ASPXAUTH': return { 'Cookie': f'{c.name}={c.value}' }
example response:
print(get_auth_header())
{'Cookie': '.ASPXAUTH=1DC9E157078115DB9255E990EADE49A7C730035DEACF4F71559FF28438C6E10F92050B5AF0D3EA580F62565D75A8A9B788A099A3913C194C234710B1052C7DD74F942398AC78773BA8E82D1DC9E1570789031A9CC43D91A6C003C2A57C00D3DA7F40101EC2D1E9C56DDD8AB3F27E408A69BFA770789031A9025EDA596A4E38501A5CE079DA092104E392AF0D3EA580F62565D75A'}
Hi! Any luck with this? Were you able to get it working?
from finviz.
Hello, I managed to reuse @NathanHRich code in order to make it work on another finviz library called finvizfinance. It shouldn't be difficult porting the changes here. Is anyone still interested?
from finviz.
Related Issues (20)
- KeyError: Sector name is wrong HOT 1
- Issue with screener
- SCREENER ERROR
- Header contains line feed code and blank characters when retrieving header HOT 1
- No results found for query when using Screener HOT 5
- Screener returning data with empty columns added HOT 2
- ValueError when converting date HOT 2
- Can't Call get_crypto(pair) with the pair name only it's number
- IndexError: list index out of range HOT 8
- Header labels are not aligned with content HOT 2
- duplicate column name in sqllite database initialization
- INDEX OUT OF RANGE HOT 1
- Issue with pyproject.toml when I try to pip install HOT 1
- News Date Issue HOT 9
- Screener data and headers are empty HOT 9
- finviz api Unable to parse page for ticker
- list index out of range HOT 13
- ValueError: time data '\r\n Today 07:00AM\r\n ' does not match format '%b-%d-%y %I:%M%p'
- Full List of Stocks on Finviz HOT 2
- get_stock() IndexError: list index out of range on line to fetch `company_details`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from finviz.