Replies: 2 comments 1 reply
-
I don't think that just replacing the protocol in the url will increase the download speed. Please correct me if i am wrong :) |
Beta Was this translation helpful? Give feedback.
0 replies
-
Yeah, you are right, http is redirected to https, not sure where the difference is coming from. Also python -m cProfile -s tottime http_test.py > prof.txt
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I managed to speed up downloading a new quarter by 0.7sec, only be internally replacing https with http in urls.
It bypasses the SSL which is slow. It's future proof, so even when SEC disables http it redirects to https.
http only:
565662 function calls (479577 primitive calls) in 5.358 seconds
ncalls tottime percall cumtime percall filename:lineno(function)
86 1.651 0.019 1.651 0.019 {method 'recv_into' of '_socket.socket' objects}
14 1.423 0.102 1.423 0.102 {built-in method time.sleep}
43 0.433 0.010 0.433 0.010 {method 'read' of '_ssl._SSLSocket' objects} <- not sure what the remaining is!
21 0.318 0.015 0.318 0.015 {method '_parse_whole' of 'xml.etree.ElementTree.XMLParser' objects}
original mixed http+https:
537159 function calls (451090 primitive calls) in 6.054 seconds
ncalls tottime percall cumtime percall filename:lineno(function)
45 1.557 0.035 1.557 0.035 {method 'read' of '_ssl._SSLSocket' objects}
14 1.455 0.104 1.455 0.104 {built-in method time.sleep}
88 1.360 0.015 1.360 0.015 {method 'recv_into' of '_socket.socket' objects}
581 0.245 0.000 0.245 0.000 {built-in method new of type object at 0x0000000060CC9C00}
21 0.207 0.010 0.207 0.010 {method '_parse_whole' of 'xml.etree.ElementTree.XMLParser' objects}
I recommend adding this:
query_response = self.connection_manager.download(file_url.replace('https','http'), headers=self.headers)
Beta Was this translation helpful? Give feedback.
All reactions