public
Last active

dell warranty check

  • Download Gist
dell_soap_check.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
#!/usr/bin/python
 
# Daniel De Marco - ddm@didiemme.net - 2012-02-23
 
# suds from https://fedorahosted.org/suds/
import suds
import sys
 
 
def get_warr(svctag):
# url = "http://xserv.dell.com/services/assetservice.asmx?WSDL"
url = "http://143.166.84.118/services/assetservice.asmx?WSDL"
client = suds.client.Client(url)
res=client.service.GetAssetInformation('12345678-1234-1234-1234-123456789012', 'dellwarrantycheck', svctag)
 
#print client
#print client.dict(res)
 
asset=res['Asset'][0]
 
hdrdata=asset['AssetHeaderData']
if 'Entitlements' in asset:
ent=asset['Entitlements'][0]
else:
ent=[]
 
shipped=hdrdata['SystemShipDate']
warrs=[]
for i in ent:
if i==None:
continue
warrs.append(i['EndDate'])
 
if warrs:
warrs.sort()
endwarranty=warrs[-1]
return (shipped.strftime("%Y-%m-%d"), endwarranty.strftime("%Y-%m-%d"))
else:
return (shipped.strftime("%Y-%m-%d"), "0000-00-00")
 
 
if __name__ == "__main__":
if len(sys.argv) != 2:
raise RuntimeError("usage: %s SERVICETAG" % sys.argv[0])
(shipped, endw)=get_warr(sys.argv[1])
print 'shipped: ', shipped
print 'end warranty: ', endw

Very well done. I used this today, but made a few modifications. Thought I'd share. This will allow a list of dictionaries including server name, and service tag.

https://gist.github.com/duanebc/6064607

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.