Skip to content

Sending JSON payload to a post request ? #14

Description

@asmodehn

Strangely this hasn't been working for me as simply as I expected...

I can't see an example that sends json data as part of the POST request in the README.
Also when I dive into the code I see only headers and params being taken care of in the request :

    def __init__(self, **kwargs):
        self.extra_request_opts = kwargs

    def request(self, api_url, method, headers, params, is_raw):
        self.logger.info(
            '\n Invoking REST Call... api_url: %s, method: %s, headers %s : ', api_url, method, headers)

        try:
            func = getattr(requests, method)
        except AttributeError:
            self.logger.error('undefined HTTP method!!! %s', method)
            raise
        response = func(api_url, headers=headers, params=params, **self.extra_request_opts)

I dont see either data or json as I would expect here...
Any hint ? Something I missed or something that needs fixing ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions