Commit 10613e28 authored by Sigmund Augdal's avatar Sigmund Augdal

We need to set x-ms-principial-name when using subscriptions

parent cad3523b
......@@ -62,7 +62,8 @@ class ODataException(Exception):
class Client(object):
passman = None
def __init__(self, baseurl, username, password, subscription=None):
def __init__(self, baseurl, username, password, subscription=None,
principial=None):
if baseurl.endswith("/"):
baseurl = baseurl[:-1]
if baseurl.endswith(ODATA_SUFFIX):
......@@ -71,6 +72,7 @@ class Client(object):
self.auth = HTTPBasicAuth(username, password)
self.session = requests.Session()
self.subscription = subscription
self.principial = principial
def _format_url(self, resource, query=None, args=None, subresource=None,
expand=None):
......@@ -99,6 +101,8 @@ class Client(object):
headers = {}
if reqdata:
headers["content-type"] = "application/atom+xml;type=entry"
if self.principial:
headers["x-ms-principal-id"] = self.principal
resp = self.session.request(method, url, data=reqdata, headers=headers,
auth=self.auth, verify=False)
data = resp.content
......
......@@ -8,7 +8,7 @@ requires = [
]
setup(name='scvmm-client-py',
version='0.4',
version='0.5',
description='',
author='',
author_email='',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment