the “self.download(url,headers)” doesn't pass headers value anymore. My previous working code a few days ago is not working anymore now. I can see the url is hit at the destination but none of the custom headers are passed. Does anyone else experiencing the same problem?
Mia Alissi
The
self.Downloadmethod in QuantConnect allows you to download data from a specified URL. It can accept header settings, a username, and a password for authentication. The headers should be passed as a dictionary. Here is an example of how you can use it:If you're experiencing issues with the headers not being passed, it might be due to changes in the server you're trying to connect to, or possibly an issue with the way the headers are being formatted.
Please ensure that the headers are correctly formatted as a dictionary and that the server you're connecting to is set up to receive and process these headers.
If the issue persists, it might be helpful to provide more details about the error message you're receiving or the behavior you're observing.
For more information, you can refer to the QuantConnect documentation.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Joe Yu Zhou
Please ignore. It turned out to be OK.
Timur
I am seeing what appears to be the same issue in Python Cloud Backtests and Live Paper on LEAN Engine v2.5.0.0.17695.
Isolated behavior:
download(url) works
download(url, {}) works
download(url, non-empty headers) returns empty string
download(url, {}, userName, password) also returns empty string
Backtest evidence:
DL2 result name=cloudflare_public_health_no_headers len=43 empty=0 preview={"ok":true,...}
DL2 result name=cloudflare_public_health_empty_headers len=43 empty=0 preview={"ok":true,...}
DL2 result name=cloudflare_public_health_user_agent len=0 empty=1 preview=
DL2 result name=github_api_private_bearer len=0 empty=1 preview=
Live Paper evidence:
LIVE_DL result name=cloudflare_public_health_no_headers len=43 empty=0 preview={"ok":true,...}
LIVE_DL result name=cloudflare_public_health_empty_headers len=43 empty=0 preview={"ok":true,...}
LIVE_DL result name=cloudflare_public_health_user_agent len=0 empty=1 preview=
LIVE_DL result name=github_private_parameters_bearer len=0 empty=1 preview=
Algorithm IDs:
Backtest DL2: cb8abfa1cc2d64e6ff4d728573f26eb1
Backtest DL3: 8788e06c589f8f6dab353989d6fedd21
Live Paper: 4b5d929b1580c7b999d505246695328e
The same authenticated GitHub request works from my local terminal with HTTP 200 and a valid body.
Joe Yu Zhou
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!