Vultr driver authenticates with api key using header instead of query param
This aligns with current api docs: https://www.vultr.com/api/ Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/aed1119a Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/aed1119a Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/aed1119a Branch: refs/heads/trunk Commit: aed1119a246af9819aca60f327ccb9a31916b08a Parents: 7ec025e Author: Francisco Ros <[email protected]> Authored: Tue May 23 17:01:50 2017 +0200 Committer: Anthony Shaw <[email protected]> Committed: Sun Jun 18 12:24:08 2017 +1000 ---------------------------------------------------------------------- libcloud/compute/drivers/vultr.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/aed1119a/libcloud/compute/drivers/vultr.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/vultr.py b/libcloud/compute/drivers/vultr.py index 52251aa..c4d14e8 100644 --- a/libcloud/compute/drivers/vultr.py +++ b/libcloud/compute/drivers/vultr.py @@ -58,15 +58,16 @@ class VultrConnection(ConnectionKey): host = 'api.vultr.com' responseCls = VultrResponse - def add_default_params(self, params): + def add_default_headers(self, headers): """ - Add parameters that are necessary for every request + Adds ``API-Key`` default header. - This method add ``api_key`` to - the request. + :return: Updated headers. + :rtype: dict """ - params['api_key'] = self.key - return params + + headers.update({'API-Key': self.key}) + return headers def encode_data(self, data): return urlencode(data)
