Skip to content

devel branch for CI pipeline #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Prev Previous commit
Next Next commit
add strip function to remove property in option
  • Loading branch information
runawaycoast committed Aug 16, 2022
commit 78cacaecb95ce7581f0487adc07d824eea6914b0
14 changes: 11 additions & 3 deletions nasdaqdatalink/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
AuthenticationError, ForbiddenError, InvalidRequestError,
NotFoundError, ServiceUnavailableError)

KW_TO_REMOVE = [
'session',
'api_config'
]


class Connection:
@classmethod
Expand Down Expand Up @@ -48,9 +53,7 @@ def execute_request(cls, http_verb, url, **options):

api_config = get_config_from_kwargs(options)

# clean the request payload
options.get('params', {}).pop('session', None)
options.get('params', {}).pop('api_config', None)
cls.options_kw_strip(options)
try:
response = session.request(method=http_verb,
url=url,
Expand Down Expand Up @@ -126,3 +129,8 @@ def handle_api_error(cls, resp):
klass = d_klass.get(code_letter, DataLinkError)

raise klass(message, resp.status_code, resp.text, resp.headers, code)

@classmethod
def options_kw_strip(self, options):
for kw in KW_TO_REMOVE:
options.get('params', {}).pop(kw, None)
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