def __init__(self, url, payload=None, post=False): bundleID = core.bundle() cacheName = core.cache(bundleID + "_requests_cache") requests_cache.configure(cacheName) if payload: self.request = requests.get(url, params=payload) if not post else requests.post(url, data=payload) else: self.request = requests.get(url)
def __init__(self): bundleID = core.bundle() self._settingsPath = core.storage(bundleID + ".settings.json") if not os.path.exists(self._settingsPath): blank = {} with codecs.open(self._settingsPath, "w", "utf-8") as f: json.dump(blank, f) self._loadedSettings = blank else: with codecs.open(self._settingsPath, "r", "utf-8") as f: payload = json.load(f) self._loadedSettings = payload
def __init__(self, **kwargs): self.title = kwargs.pop("title", "") self.subtitle = kwargs.pop("subtitle", "") self.uid = kwargs.pop("uid", "{0}.{1}".format(core.bundle(), random.getrandbits(40))) if "valid" in kwargs.keys(): if kwargs["valid"] == True: self.valid = "yes" elif kwargs["valid"] == False: self.valid = "no" else: self.valid = kwargs["valid"] kwargs.pop("valid") else: self.valid = None self.autocomplete = kwargs.pop("autocomplete", None) self.icon = kwargs.pop("icon", "icon.png") self.fileIcon = kwargs.pop("fileIcon", False) self.fileType = kwargs.pop("fileType", False) self.arg = kwargs.pop("arg", None) self.type = kwargs.pop("type", None)