Skip to content

Commit 24e8845

Browse files
author
Ren Ren
committed
reuse adapter
1 parent e661698 commit 24e8845

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

nasdaqdatalink/connection.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def request(http_verb, url, **options):
3636
return execute_request(http_verb, abs_url, **options)
3737

3838
def execute_request(http_verb, url, **options):
39-
session = get_session(url)
39+
session = get_session()
4040

4141
try:
4242
response = session.request(method=http_verb,
@@ -67,10 +67,10 @@ def get_retries():
6767
return retries
6868

6969
session = requests.Session()
70+
adapter = HTTPAdapter(max_retries=get_retries())
71+
session.mount(ApiConfig.api_protocol, adapter)
7072

71-
def get_session(url = ApiConfig.api_protocol):
72-
adapter = HTTPAdapter(max_retries=get_retries())
73-
session.mount(url, adapter)
73+
def get_session():
7474
return session
7575

7676
def parse(response):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy