Created
October 13, 2012 01:59
-
-
Save SecurityForUs/3882909 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class APIBase(ClassBase): | |
# Both SL and SVB require authentication tokens. So we set a field here for them | |
tokens = {'sl' : "", 'svb' : ""} | |
# Enable support for proxies | |
proxy = {"https" : ""} | |
def __init__(self, class_name = "api.base"): | |
ClassBase.__init__(self, class_name) | |
self.proxy = {"https" : ""} | |
self.tokens['sl'] = "" | |
self.tokens['svb'] = "" | |
def head(self, options): | |
print "sl token:",self.tokens['sl'] | |
from api.base import APIBase as Base | |
class SVB(Base): | |
# Simple method so I don't have to keep changing the URI, i can just change the key value | |
urls = {"dev" : "http://192.168.1.6/newsvb/api/", "prod" : "https://www.securevolumebackup.com/api/" } | |
options = {'url' : '', 'method' : '', 'data' : dict(), 'headers' : dict()} | |
def reset_options(self): | |
self.options['method'] = '' | |
self.options['data'] = dict() | |
self.options['headers'] = dict() | |
def __init__(self): | |
Base.__init__(self, "api.svb") | |
self.token = self.req('login') | |
self.tokens.update({'sl' : "asdf"}) # self.tokens['sl'] wasn't working so tried this | |
# SL() is called after SVB initialization, so I think I know what the issue is...(sigh) lol | |
class SL(Base): | |
def __init__(self): | |
Base.__init__(self, "api.sl") | |
self.head("poop") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment