Skip to content

Commit

Permalink
Request body object serialize fix (#41)
Browse files Browse the repository at this point in the history
* Fixed to correctly serialize request body 'objects'
* Fixed lint errors
  • Loading branch information
ptrakhtman authored Jun 10, 2020
1 parent 1b102c3 commit 322cc7e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions almdrlib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '1.0.26'
__version__ = '1.0.27'
__author__ = 'Alert Logic, Inc.'

import logging
Expand Down Expand Up @@ -52,6 +52,7 @@ def client(service_name, version=None, session=None, *args, **kwargs):
session = _get_default_session()
return session.client(service_name, version, *args, **kwargs)


def configure(
profile=almdrlib.constants.DEFAULT_PROFILE,
access_key_id=None, secret_key=None,
Expand All @@ -63,7 +64,6 @@ def configure(
global_endpoint=global_endpoint, residency=residency)



# Logging to dev/null
# http://docs.python.org/3.3/howto/logging.html#configuring-logging-for-a-library
class NullHandler(logging.Handler):
Expand Down
2 changes: 1 addition & 1 deletion almdrlib/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def serialize(self, kwargs, headers=None):
if self._explode:
kwargs['data'] = json.dumps(result.pop(self.name))
else:
kwargs['data'] = json.dumps({self.name: result})
kwargs['data'] = json.dumps(result)

@property
def schema(self):
Expand Down
5 changes: 3 additions & 2 deletions almdrlib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import configparser
import logging
import almdrlib.constants
from almdrlib.exceptions import AlmdrlibValueError

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -154,10 +155,10 @@ def configure(

try:
parser.add_section(profile)
except configparser.DuplicateSectionError as e:
except configparser.DuplicateSectionError:
# section alread exists.
pass
except configparser.ValueError as e:
except configparser.ValueError:
# almdrlib.constants.DEFAULT_PROFILE was passed as the section name
pass

Expand Down
2 changes: 1 addition & 1 deletion almdrlib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import os.path

DEFAULT_CONFIG_DIR = os.path.join(os.path.expanduser("~"), ".alertlogic")
DEFAULT_CONFIG_DIR = os.path.join(os.path.expanduser("~"), ".alertlogic")
DEFAULT_CONFIG_FILE = os.path.join(DEFAULT_CONFIG_DIR, "config")
DEFAULT_CREDENTIALS_FILE = os.path.join(DEFAULT_CONFIG_DIR, "credentials")
DEFAULT_PROFILE = "default"
Expand Down
2 changes: 1 addition & 1 deletion almdrlib/docs/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import itertools
try:
from m2r import convert
except Exception as e:
except Exception:
def convert(text):
return text

Expand Down

0 comments on commit 322cc7e

Please sign in to comment.