def _hotlinkfile(self, fileid=None, hotlink=None, name=None, folder=None, folderid=None): # return: # プレミアム垢ないので未実装 # 型チェック if fileid and not isinstance(fileid, str): raise HotfileError('fileid is invalid str type. ex.) fileid = ""') if hotlink and not isinstance(hotlink, int): raise HotfileError('hotlink is invalid int type. ex.) hotlink = 0 or 1') if name and not isinstance(name, str): raise HotfileError('name is invalid str type. ex.) name = ""') if folder and not isinstance(folder, str): raise HotfileError('folder is invalid str type. ex.) folder = ""') if folderid and not isinstance(folderid, str): raise HotfileError('folderid is invalid str type. ex.) folderid = ""') # on/offチェック if not hotlink == 0 or not hotlink == 1: raise HotfileError('Invalid value. 0: Disable hotlink. 1: Enable hotlink.') # binder = Binder( api = self, action = 'hotlinkfile', parse_type='', options = { 'fileid':fileid, 'hotlink':hotlink, 'name':name, 'folder':folder, 'folderid':folderid }, format = False, login = True, premium = True ) return binder._execute()
def _checklinks(self, links=None, ids=None, keys=None): # 引数チェック: linksまたはidsとkeysを引数としていない場合エラーを吐く if not links: if not ids or not keys: raise HotfileError('Required links or ids and keys.') # 引数の型チェック if links and not isinstance(links, list): raise HotfileError('links is invalid list type. ex.) links = ["http://hotfile.com/dl/(id)/(key)/(file name).html",]') if ids and not isinstance(ids, list): raise HotfileError('ids is invalid list type. ex.) ids = ["123456789",]') if keys and not isinstance(keys, list): raise HotfileError('keys is invalid list type. ex.) keys = ["abcdefghi",]') binder = Binder( api = self, action = 'checklinks', parse_type='fields', options = { 'links':links, 'ids':ids, 'keys':keys, }, format = True, login = False, premium = False ) return binder._execute()
def _undeletefile(self, fileid=None, name=None, folder=None, folderid=None): # return: OK or error message. (".file not found") # 型チェック if fileid and not isinstance(fileid, str): raise HotfileError('fileid is invalid str type. ex.) fileid = ""') if name and not isinstance(name, str): raise HotfileError('name is invalid str type. ex.) name = ""') if folder and not isinstance(folder, str): raise HotfileError('folder is invalid str type. ex.) folder = ""') if folderid and not isinstance(folderid, str): raise HotfileError('folderid is invalid str type. ex.) folderid = ""') # binder = Binder( api = self, action = 'undeletefile', parse_type='raw', options = { 'fileid':fileid, 'name':name, 'folder':folder, 'folderid':folderid }, format = False, login = True, premium = False ) return binder._execute()
def _createfolder(self, name, parentfolderid=None, parentfolder=None): # return: folderid,folderhash,path # 型チェック if not isinstance(name, str): raise HotfileError('name is invalid str type. ex.) name = ""') if parentfolderid and not isinstance(parentfolderid, str): raise HotfileError('parentfolderid is invalid str type. ex.) parentfolderid = ""') if parentfolder and not isinstance(parentfolder, str): raise HotfileError('parentfolder is invalid str type. ex.) parentfolder = ""') # binder = Binder( api = self, action = 'createfolder', parse_type='comma', options = { 'name':name, 'parentfolderid':parentfolderid, 'parentfolder':parentfolder }, format = False, return_keys = ['folderid', 'folderhash', 'path'], login = True, premium = False ) return binder._execute()
def _getuserinfo(self): binder = Binder( api = self, action = 'getuserinfo', parse_type = 'qstr', options = None, format = False, login = True, premium = False ) return binder._execute()
def _getdigest(self): binder = Binder( api = self, action = 'getdigest', parse_type = 'raw', options = None, format = False, login = False, premium = False ) return binder._execute()
def _sendvalidationcode(self): # return: OK/error message # binder = Binder( api = self, action = 'sendvalidationcode', parse_type='raw', options = None, format = False, login = True, premium = False ) return binder._execute()
def _getdirectdownloadlinks(self, links): # return: # プレミアム垢ないので未実装 # 型チェック if not isinstance(links, list): raise HotfileError('links is invalid list type. ex.) links = ["",""]') # binder = Binder( api = self, action = 'getdirectdownloadlinks', parse_type='raw', options = { 'links':links }, format = False, login = True, premium = True ) return binder._execute()
def _getuploadserver(self, count=None): # 型チェック if count and not isinstance(count, int): raise HotfileError('count is invalid int type. ex.) count = ["",""]') # 最大値チェック if count and not count < 0 and count > 5: raise HotfileError('count is maximum 5.') binder = Binder( api = self, action = 'getuploadserver', parse_type='lf', options = { 'count':count }, format = False, login = False, premium = False ) return binder._execute()
def _getdirectdownloadlink(self, link, alllinks=None): # 未実装 # return: # 型チェック if not isinstance(link, str): raise HotfileError('link is invalid str type. ex.) ids = ""') if alllinks and not isinstance(alllinks, list): raise HotfileError('alllinks is invalid list type. ex.) alllinks = ["",""]') binder = Binder( api = self, action = 'getdirectdownloadlink', parse_type='Raw', options = { 'link':link, 'alllinks':alllinks }, format = False, login = True, premium = True ) return binder._execute()
def _changepassword(self, password_new ,validationcode): # return: OK/error message # 型チェック if not isinstance(password_new, str): raise HotfileError('psasword_new is invalid str type. ex.) psasword_new = ""') if not isinstance(validationcode, str): raise HotfileError('validationcode is invalid str type. ex.) validationcode = ""') # binder = Binder( api = self, action = 'changepassword', parse_type='raw', options = { 'password_new':password_new, 'validationcode':validationcode }, format = False, login = True, premium = False ) return binder._execute()
def _renamefolder(self, name=None, parentfolderid=None, parentfolder=None, folderid=None, newname=None, newparentfolderid=None, newparentfolder=None): # return: # どのようなパラメータ入れても、APIエラーが発生するため未実装。 # 型チェック if name and not isinstance(name, str): raise HotfileError('name is invalid str type. ex.) name = ""') if parentfolderid and not isinstance(parentfolderid, str): raise HotfileError('parentfolderid is invalid str type. ex.) parentfolderid = ""') if parentfolder and not isinstance(parentfolder, str): raise HotfileError('parentfolder is invalid str type. ex.) parentfolder = ""') if folderid and not isinstance(folderid, str): raise HotfileError('folderid is invalid str type. ex.) folderid = ""') if newname and not isinstance(newname, str): raise HotfileError('newname is invalid str type. ex.) newname = ""') if newparentfolderid and not isinstance(newparentfolderid, str): raise HotfileError('newparentfolderid is invalid str type. ex.) newparentfolderid = ""') if newparentfolder and not isinstance(newparentfolder, str): raise HotfileError('newparentfolder is invalid str type. ex.) newparentfolder = ""') # binder = Binder( api = self, action = 'renamefolder', parse_type='raw', options = { 'name':name, 'parentfolderid':parentfolderid, 'parentfolder':parentfolder, 'folderid':folderid, 'newname':newname, 'newparentfolderid':newparentfolderid, 'newparentfolder':newparentfolder }, format = False, login = True, premium = False ) return binder._execute()
def _getdownloadlinksfrompublicdirectory(self, folder, hash, forcenonprem=None): # return:ファイル名|リンクURL\n # 型チェック if not isinstance(folder, str): raise HotfileError('folder is invalid int type. ex.) folder = ""') if not isinstance(hash, str): raise HotfileError('hash is invalid str type. ex.) hash = ""') if forcenonprem and not isinstance(forcenonprem, str): raise HotfileError('forcenonprem is invalid str type. ex.) forcenonprem = ""') # binder = Binder( api = self, action = 'getdownloadlinksfrompublicdirectory', parse_type='raw', options = { 'folder':folder, 'hash':hash, 'forcenonprem':forcenonprem }, format = False, login = True, premium = False ) return binder._execute()
def _deletefolder(self, name=None, parentfolderid=None, parentfolder=None): # return: "OK" or error message(".folder does not exists"). # 型チェック if name and not isinstance(name, str): raise HotfileError('name is invalid str type. ex.) name = ""') if parentfolderid and not isinstance(parentfolderid, str): raise HotfileError('parentfolderid is invalid str type. ex.) parentfolderid = ""') if parentfolder and not isinstance(parentfolder, str): raise HotfileError('parentfolder is invalid str type. ex.) parentfolder = ""') # binder = Binder( api = self, action = 'deletefolder', parse_type='raw', options = { 'name':name, 'parentfolderid':parentfolderid, 'parentfolder':parentfolder }, format = False, login = True, premium = False ) return binder._execute()