From b2f78ab6053b51fa8ecf1e94e5eff58da7a7d1dd Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Thu, 10 Jan 2013 11:20:13 +0200 Subject: Added CompTIA --- gsx.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'gsx.py') diff --git a/gsx.py b/gsx.py index 5adc33c..36b3185 100755 --- a/gsx.py +++ b/gsx.py @@ -1,6 +1,8 @@ #coding=utf-8 import re +import os +import json import base64 from suds.client import Client from datetime import date, time @@ -111,6 +113,24 @@ class GsxObject(object): return data +class CompTia: + """ + Stores and accesses CompTIA codes. + This should really be fetched from GSX, but suds gives this error: + suds.TypeNotFound: Type not found: 'comptiaDescription' + when calling CompTIACodes()... + """ + def __init__(self): + df = open(os.path.join(os.path.dirname(__file__), 'comptia.json')) + self.data = json.load(df) + + def symptoms(self, component=None): + symptoms = self.data['symptoms'] + return symptoms[component] if component else symptoms + + def modifiers(self): + return self.data['modifiers'] + class Lookup(GsxObject): def parts(self): """ -- cgit v1.2.3