Skip to content

403 errors from Avalara validating address #14

Closed
@LiteWait

Description

@LiteWait

This code has been working for 2 years, but seems Avalara changed something in their APIs. Since the _request method (whether you are providing a GET or POST) always adds a request body (aka: 'data') this causes Avalara to throw a 403 error on GETs. Simple fix is to not provide 'data' on get.

def _request(self, http_method, stem, data={}, params={}):
      url = '%s/%s' % (self.url, stem)
      data = json.dumps(data)
      # getting rid of control characters
      # that JSON will error out on
      data = data.replace('\\r', ' ')
      data = data.replace('\\t', ' ')
      data = data.replace('\\n', ' ')
      kwargs = {
          'params': params,
          'data': data,    REMOVE THIS AND THE 403 GOES AWAY
          'headers': self.headers,
          'auth': (self.username, self.password),
          'proxies': self.proxies,
          'timeout': self.timeout
      }

Please advise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions