# Buggy code
def create_external_tool(
    self, name, privacy_level, consumer_key, shared_secret, **kwargs
):
    """
        Create an external tool in the current account.

        :calls: `POST /api/v1/accounts/:account_id/external_tools \
        <https://canvas.instructure.com/doc/api/external_tools.html#method.external_tools.create>`_

        :param name: The name of the tool
        :type name: str
        :param privacy_level: What information to send to the external
            tool. Options are "anonymous", "name_only", "public"
        :type privacy_level: str
        :param consumer_key: The consumer key for the external tool
        :type consumer_key: str
        :param shared_secret: The shared secret with the external tool
        :type shared_secret: str
        :rtype: :class:`canvasapi.external_tool.ExternalTool`
        """
    from canvasapi.external_tool import ExternalTool

    response = self._requester.request(
        "POST",
        "accounts/{}/external_tools".format(self.id),
        _kwargs=combine_kwargs(**kwargs),
    )
    response_json = response.json()
    response_json.update({"account_id": self.id})

    return ExternalTool(self._requester, response_json)


# Traceback (canvasapi.exceptions.BadRequest)
tool = {
"custom_fields": {
"canvas_membership_roles": "$Canvas.membership.roles"
},
"course_navigation": {
"default": "disabled",
"text": "Tool Name",
"enabled": "true",
"visibility": "admins",
"label": "Course Emailer",
"selection_width": 700,
"selection_height": 800
},
"consumer_key": "override_me",
"shared_secret": "override_me",
"selection_height": 700,
"selection_width": 800,
"privacy_level": "public",
"url": "https://tools.example.net/lti_launch",
"domain": "tools.example.net",
"name": "ToolName",
"description": "This LTI tool does stuff.",
}

# get an account instance...
A=canvas_test.canvas.get_account(account_id)
A.create_external_tool(**tool)


Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/Users/ialtgi01/PycharmProjects/canvas-refresh-fixer/env/lib/python3.5/site-packages/canvasapi/account.py", line 689, in create_external_tool
_kwargs=combine_kwargs(**kwargs)
File "/Users/ialtgi01/PycharmProjects/canvas-refresh-fixer/env/lib/python3.5/site-packages/canvasapi/requester.py", line 100, in request
raise BadRequest(response.text)
canvasapi.exceptions.BadRequest: {"errors":{"name":[{"attribute":"name","type":"blank","message":"blank"}],"consumer_key":[{"attribute":"consumer_key","type":"blank","message":"blank"}],"shared_secret":[{"attribute":"shared_secret","type":"blank","message":"blank"}]}}

# Fixed code
def create_external_tool(
    self, name, privacy_level, consumer_key, shared_secret, **kwargs
):
    """
        Create an external tool in the current account.

        :calls: `POST /api/v1/accounts/:account_id/external_tools \
        <https://canvas.instructure.com/doc/api/external_tools.html#method.external_tools.create>`_

        :param name: The name of the tool
        :type name: str
        :param privacy_level: What information to send to the external
            tool. Options are "anonymous", "name_only", "public"
        :type privacy_level: str
        :param consumer_key: The consumer key for the external tool
        :type consumer_key: str
        :param shared_secret: The shared secret with the external tool
        :type shared_secret: str
        :rtype: :class:`canvasapi.external_tool.ExternalTool`
        """
    from canvasapi.external_tool import ExternalTool

    response = self._requester.request(
        "POST",
        "accounts/{}/external_tools".format(self.id),
        name=name,
        privacy_level=privacy_level,
        consumer_key=consumer_key,
        shared_secret=shared_secret,
        _kwargs=combine_kwargs(**kwargs),
    )
    response_json = response.json()
    response_json.update({"account_id": self.id})

    return ExternalTool(self._requester, response_json)