Shows the product code and serial number of a Thinkpad (of any computer with those information actually) and opens the Lenovo support and warranty pages for that system. It might work with other Lenovo computers too.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | import webbrowser
import wmi
base_url = "http://www-307.ibm.com/pc/support/site.wss/"
support_url = base_url + "quickPath.do?sitestyle=lenovo&quickPathEntry=%s"
warranty_url = base_url + "warrantyLookup.do?sitestyle=lenovo&country=897&type=%s&serial=%s"
for csproduct in wmi.WMI().Win32_ComputerSystemProduct():
# show information
print "%s %s" % (csproduct.Vendor, csproduct.Version)
print "%s %s" % (csproduct.Name, csproduct.IdentifyingNumber)
# open support and warranty pages
webbrowser.open(support_url % csproduct.Name)
webbrowser.open(warranty_url % (csproduct.Name[:4], csproduct.IdentifyingNumber))
|
The recipe uses the wmi
module from http://pypi.python.org/pypi/WMI/
It shows how to use the WMI module to gather some basic information about the computer system and how to open a web browser with a specific url.
Issues: I don't really know whether the country
parameter changes anything but it has to be there.