Skip to content

Instantly share code, notes, and snippets.

@teroka
Created November 8, 2014 19:38
Show Gist options
  • Save teroka/0720274b87b77fe7171f to your computer and use it in GitHub Desktop.
Save teroka/0720274b87b77fe7171f to your computer and use it in GitHub Desktop.
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()
@ShortArrow
Copy link

Thank you for mentioning. I tried it now and it succeeded.
I gave up and forgot for a long time.

@ShortArrow succeeded for a what level, what did you accomplished? any errors? 404s?

It means that I was able to log in to https://developer.dell.com/. I couldn't do it at that time, so I gave up and left it.

@Gomesz785
Copy link

Gomesz785 commented Oct 1, 2021

Thank you for mentioning. I tried it now and it succeeded.
I gave up and forgot for a long time.

@ShortArrow succeeded for a what level, what did you accomplished? any errors? 404s?

It means that I was able to log in to https://developer.dell.com/. I couldn't do it at that time, so I gave up and left it.

@ShortArrow So in 2021 you was able to:

I am asking how tried it now and it succeeded?
Are you saying that you couldn't get the data by using a correct service tag that time and 2021 but in 2021 you were finally able to login? Am I correct?

Also did you saw this?

@ShortArrow
Copy link

Thank you for mentioning. I tried it now and it succeeded.
I gave up and forgot for a long time.

@ShortArrow succeeded for a what level, what did you accomplished? any errors? 404s?

It means that I was able to log in to https://developer.dell.com/. I couldn't do it at that time, so I gave up and left it.

@ShortArrow So in 2021 you was able to:

I am asking how tried it now and it succeeded? Are you saying that you couldn't get the data by using a correct service tag that time and 2021 but in 2021 you were finally able to login? Am I correct?

Also did you saw this?

  1. Write password and email.
  2. A few digits code will be sent by email.
  3. Enter the code.
  4. Finish the login.

image

I couldn't do just this on 14 Jan 2020, Due to a server error.

@Gomesz785
Copy link

Gomesz785 commented Oct 2, 2021

Thank you for mentioning. I tried it now and it succeeded.
I gave up and forgot for a long time.

@ShortArrow succeeded for a what level, what did you accomplished? any errors? 404s?

It means that I was able to log in to https://developer.dell.com/. I couldn't do it at that time, so I gave up and left it.

@ShortArrow So in 2021 you was able to:

I am asking how tried it now and it succeeded? Are you saying that you couldn't get the data by using a correct service tag that time and 2021 but in 2021 you were finally able to login? Am I correct?
Also did you saw this?

  1. Write password and email.
  2. A few digits code will be sent by email.
  3. Enter the code.
  4. Finish the login.

image

I couldn't do just this on 14 Jan 2020, Due to a server error.

@ShortArrow

  1. And you couldn't get a API key?
  2. You used the script to its full usage?
  3. You understand the script?
  4. Isn't the key on the script work?
  5. Is the script correct?

@ShortArrow
Copy link

@Gomesz785

Ok I'll try it. please wait.

@ShortArrow
Copy link

@Gomesz785 Wow, unfortunately it failed. My test result is here.

The code is a bit modified from the one at the top of the thread. Added parentheses for print statements.

(dell) PS C:\Users\who\Documents\GitHub\dell-warranty> python .\dell_warranty.py 6G331Y2
[6G331Y2] Caught 404 as the response code.
[6G331Y2] Unable to get details for given service tag.
(dell) PS C:\Users\who\Documents\GitHub\dell-warranty> python .\dell_warranty.py 6g331y2
[6g331y2] Caught 404 as the response code.
[6g331y2] Unable to get details for given service tag.
(dell) PS C:\Users\who\Documents\GitHub\dell-warranty> conda list
# packages in environment at C:\tools\miniconda3\envs\dell:
#
# Name                    Version                   Build  Channel
black                     21.9b0                   pypi_0    pypi
ca-certificates           2021.7.5             haa95532_1
certifi                   2021.5.30        py39haa95532_0
charset-normalizer        2.0.6                    pypi_0    pypi
click                     8.0.1                    pypi_0    pypi
colorama                  0.4.4                    pypi_0    pypi
idna                      3.2                      pypi_0    pypi
mypy-extensions           0.4.3                    pypi_0    pypi
openssl                   1.1.1l               h2bbff1b_0
pathspec                  0.9.0                    pypi_0    pypi
pip                       21.2.4           py38haa95532_0
platformdirs              2.4.0                    pypi_0    pypi
python                    3.9.7                h6244533_1
regex                     2021.9.30                pypi_0    pypi
requests                  2.26.0                   pypi_0    pypi
setuptools                58.0.4           py39haa95532_0
sqlite                    3.36.0               h2bbff1b_0
tomli                     1.2.1                    pypi_0    pypi
typing-extensions         3.10.0.2                 pypi_0    pypi
tzdata                    2021a                h5d7bf9c_0
urllib3                   1.26.7                   pypi_0    pypi
vc                        14.2                 h21ff451_1
vs2015_runtime            14.27.29016          h5e58377_2
wheel                     0.37.0             pyhd3eb1b0_1
wincertstore              0.2              py39haa95532_2
(dell) PS C:\Users\who\Documents\GitHub\dell-warranty>

For vscode debugging ,.vscode\launch.json settings are shown below.

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "args": ["1111111"] // your service tag
        }
    ]
}

@robertjoodat
Copy link

Thank you!

@Gomesz785
Copy link

Thank you!

You were able to use this?

@AngeloD2022
Copy link

AngeloD2022 commented Jul 21, 2022

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.

I decrypted and released their API key in the QRL app for android and soon after, received a DMCA complaint, forcing me to privatize the repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment