File tree Expand file tree Collapse file tree 5 files changed +25
-5
lines changed
Expand file tree Collapse file tree 5 files changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -6,3 +6,4 @@ redfish_client.egg-info
66htmlcov
77dist
88build /
9+ Pipfile.lock
Original file line number Diff line number Diff line change @@ -17,8 +17,15 @@ coverage:
1717 xdg-open htmlcov/index.html
1818
1919lint :
20- pipenv run pylint redfish_client
20+ pipenv run ruff redfish_client
2121
2222publish :
23+ rm -f dist/*
24+
25+ pipenv --rm
26+ rm Pipfile.lock
27+ pipenv --python 3.11
28+ pipenv install --dev
2329 pipenv run python setup.py sdist bdist_wheel
30+
2431 pipenv run python -m twine upload -r metify-internal dist/*
Original file line number Diff line number Diff line change @@ -158,10 +158,17 @@ def _session_login(self):
158158 resp = self ._client .post (self ._url (self ._session_path ), json = dict (
159159 UserName = self ._username , Password = self ._password ,
160160 ), timeout = self ._timeout )
161- if resp .status_code != 201 :
161+ if resp .status_code not in [ 201 , 204 ] :
162162 raise AuthException ("Cannot create session: {}" .format (resp .text ))
163163
164- self ._set_header ("x-auth-token" , resp .headers ["x-auth-token" ])
164+ if resp .status_code == 201 :
165+ # 201: Redfish standard
166+ self ._set_header ("x-auth-token" , resp .headers ["x-auth-token" ])
167+ else :
168+ # 204: Redfish Mock Server standard
169+ # No auth token is returned so set to anything
170+ self ._set_header ("x-auth-token" , resp .headers .get ("location" ))
171+
165172 # We combine with `or` here because the default value of the dict.get
166173 # method is eagerly evaluated, which is not what we want.
167174 sess_id = resp .headers .get ("location" ) or resp .json ()["@odata.id" ]
Original file line number Diff line number Diff line change 1111# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212# See the License for the specific language governing permissions and
1313# limitations under the License.
14-
14+ import json
1515import operator
1616import time
1717from functools import reduce
@@ -130,6 +130,9 @@ def dig(self, *keys):
130130 return None
131131 return resource
132132
133+ def jp (self ):
134+ return json .dumps (self .raw , indent = 4 , sort_keys = True )
135+
133136 def find_object (self , key ):
134137 """ Recursively search for a key and return key's content """
135138 if key in self ._get_content ().keys ():
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ description = Redfish API client for Python
1010long_description = file: README.rst
1111long_description_content_type = text/x-rst
1212license_file = LICENSE
13- version = 0.3.10
13+ version = 0.3.12
1414classifier =
1515 Development Status :: 3 - Alpha
1616 Environment :: Console
@@ -24,6 +24,8 @@ classifier =
2424 Programming Language :: Python :: 3.7
2525 Programming Language :: Python :: 3.8
2626 Programming Language :: Python :: 3.9
27+ Programming Language :: Python :: 3.10
28+ Programming Language :: Python :: 3.11
2729
2830[files]
2931packages =
You can’t perform that action at this time.
0 commit comments