Dell API: Warranty Information
#!/usr/bin/env python | |
# Quick script to check your Dell asset's warranty status | |
# Just drop your service tag as parameters for the script and go. | |
import sys | |
import requests | |
APIKEY = 'd676cf6e1e0ceb8fd14e8cb69acd812d' | |
URL = 'https://api.dell.com/support/v2/assetinfo/warranty/tags.json?svctags={0}&apikey=' + APIKEY | |
def get_warr_from_dell(svctag): | |
res = requests.get(URL.format(svctag)) | |
if res.status_code != 200: | |
sys.stderr.write('[%s] Caught %i as the response code.\n' % (svctag, res.status_code)) | |
sys.stderr.write('[%s] Unable to get details for given service tag.\n' | |
% svctag) | |
return False | |
fault = res.json['GetAssetWarrantyResponse']['GetAssetWarrantyResult']['Faults'] | |
if fault is not None: | |
sys.stderr.write("[%s] Failed to find details. Sure it's a valid TAG?\n" % svctag ) | |
return False | |
asset = res.json['GetAssetWarrantyResponse']['GetAssetWarrantyResult']['Response']['DellAsset'] | |
model = asset['MachineDescription'] | |
ent = asset['Warranties']['Warranty'] | |
shipped = asset['ShipDate'] | |
print 'Service Tag: ', svctag | |
print ' Model: ', model | |
print ' Shipped: ', shipped, '\n' | |
print '{0:<20} {1:>15}'.format(*('Warranty Ends','ServiceLevelDescription')) | |
for warr in [(d['EndDate'],d['ServiceLevelDescription']) for d in ent]: | |
print '{0:<20} {1:>15}'.format(*warr) | |
if __name__ == '__main__': | |
get_warr_from_dell(sys.argv[1]) | |
sys.exit() |
This comment has been minimized.
This comment has been minimized.
Go to https://developer.dell.com/, create a key, and wait forever for them to approve it. I requested mine over 2 months ago, contacted them twice and got nothing. Dell is such a terrible company. |
This comment has been minimized.
This comment has been minimized.
THANK YOU. Making me look like a genius for my workplace |
This comment has been minimized.
This comment has been minimized.
I can't access "https://developer.dell.com/". NET::ERR_CERT_AUTHORITY_INVALID |
This comment has been minimized.
This comment has been minimized.
still on certificate problems, website cant be reached...
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
How to apply apiKey