def execute(self, path, uri, params): if (path is not None): command = singletonURIHelperInstance.getUri( self.COMPONENT_TYPE, "catalog") requestUrl = command.format(path) else: command = singletonURIHelperInstance.getUri( self.COMPONENT_TYPE, "get-service") requestUrl = command.format(uri) paramsDict = common.toDict(params) #If the label object is null, then it shows an error if(not(paramsDict.has_key("label"))): paramsDict["label"]="" query = None if (params is not None): for key, value in paramsDict.iteritems(): if (query is None): query = "?" + key + "=" + value else: query = query + "&" + key + "=" + value if (query is not None): requestUrl = requestUrl + query # The requestUrl has '' as a string instead of an empty string. requestUrl=requestUrl.replace("''","") (s, h) = common.service_json_request( self.__ipAddr, self.__port, "POST", requestUrl, None, None) o = common.json_decode(s) return o
def execute(self, path, uri, params): if (path is not None): command = singletonURIHelperInstance.getUri( self.COMPONENT_TYPE, "catalog") requestUrl = command.format(path) else: command = singletonURIHelperInstance.getUri( self.COMPONENT_TYPE, "get-service") requestUrl = command.format(uri) paramsDict = common.toDict(params) #If the label object is null, then it shows an error if (not (paramsDict.has_key("label"))): paramsDict["label"] = "" query = None if (params is not None): for key, value in paramsDict.iteritems(): if (query is None): query = "?" + key + "=" + value else: query = query + "&" + key + "=" + value if (query is not None): requestUrl = requestUrl + query # The requestUrl has '' as a string instead of an empty string. requestUrl = requestUrl.replace("''", "") (s, h) = common.service_json_request(self.__ipAddr, self.__port, "POST", requestUrl, None, None) o = common.json_decode(s) return o
def yaya_book(*, id=None): book = DataObject.get_yaya_books(id=id) book_data = None if book: book = book[0] book_json_name = f"/{YAYA_BASE_PATH}/{book['id']}.{book['name']}/{book['id']}.resourceDetail.json" book_data = read_json_file(book_json_name)['data'] res_data = { 'announcer': '白宇航', 'id': 2269, 'name': '咪子的家', 'ageDesc': '4-6岁', 'cover': 'http://cover.yayagushi.com/e29ae422522840f58294f06b5b9572d7_%s.png', 'desc': '小女孩有一只小猫“咪子”,一天它突然消失了。小女孩体验了失去并寻找咪子的失望和希望,也收获了新生命的惊奇和感动。\n\n猫咪带给了女孩生命的启示,关于信任、母性之爱。故事质朴温暖、情感真挚。', 'estimatedChapter': 16, 'totalChapter': 16, 'labelList': ['爱与情感', '生命', '温暖', '亲情', '友情', '动物'] } if book_data: res_data['announcer'] = book_data['announcer']['nickName'] if 'announcer' in book_data and 'nickName' in book_data['announcer'] else '未知' res_data['id'] = book_data['resource']['id'] res_data['name'] = book_data['resource']['name'] res_data['ageDesc'] = book_data['resource']['ageDesc'] res_data['cover'] = book_data['resource']['cover'].replace('http://', '//').replace('.png', '_%s.png') res_data['desc'] = book_data['resource']['desc'].replace('\n', '<br />') res_data['estimatedChapter'] = book_data['resource']['estimatedChapter'] res_data['totalChapter'] = book_data['resource']['totalChapter'] res_data['labelList'] = book_data['resource']['labelList'] res_data['priceType'] = book_data['resource']['priceType'] return { 'book': toDict(res_data), '__template__': 'yaya_book.html' }
def xmly_book(*, id=None): book = DataObject.get_xmly_books(id=id) book_data = None albums = None if book: book = book[0] book['audio'] = get_cdn_url(f"/{XMLY_BASE_PATH}/{book['recordId']}.{book['recordTitle'].replace('|', '')}/{book['recordTitle'].replace('|', '')}.m4a") book_json_name = f"/{XMLY_BASE_PATH}/{book['recordId']}.{book['recordTitle'].replace('|', '')}/{book['recordId']}.{book['recordTitle']}.json" book_screen = read_json_file(book_json_name) book['count'] = book_screen['screenCnt'] album_id = book['albumId'] album = DataObject.get_xmly_albums(album_id) if album: album = album[0] return { 'book': toDict(book), 'album': toDict(album), '__template__': 'xmly_book.html' }
def list(self, type, params): command = singletonURIHelperInstance.getUri(self.COMPONENT_TYPE, "list") requestUrl = command.format(type) paramsDict = common.toDict(params) query = None if (params is not None): for key, value in paramsDict.iteritems(): if (query is None): query = "?" + key + "=" + value else: query = query + "&" + key + "=" + value if (query is not None): requestUrl = requestUrl + query (s, h) = common.service_json_request(self.__ipAddr, self.__port, "GET", requestUrl, None, None) o = common.json_decode(s) return o
def list(self, type, params): command = singletonURIHelperInstance.getUri( self.COMPONENT_TYPE, "list") requestUrl = command.format(type) paramsDict = common.toDict(params) query = None if (params is not None): for key, value in paramsDict.iteritems(): if (query is None): query = "?" + key + "=" + value else: query = query + "&" + key + "=" + value if (query is not None): requestUrl = requestUrl + query (s, h) = common.service_json_request(self.__ipAddr, self.__port, "GET", requestUrl, None, None) o = common.json_decode(s) return o
__author__ = 'Arms' ''' 编译xcode工程并生成ipa文件 ''' import commands import sys import os import datetime from config import xcodeBuildConfigs from common import ShellError, Dict, toDict from uploadsvn import uploadipa buildConfig = toDict(xcodeBuildConfigs) if __name__ == '__main__': mode = sys.argv[1] params = None cleanCommand = None buildCommand = None createIPACommand = None ipaPath = None if mode == 'debug': params = buildConfig.debug ipaPath = '~/Desktop/%s_%s_test_%s.ipa' % ( params.project, params.version, datetime.datetime.now().strftime("%m%d%H%M")) buildCommand = 'xcodebuild -project %s.xcodeproj -target %s -configuration %s -sdk %s build CODE_SIGN_IDENTITY="%s" PROVISIONING_PROFILE="%s"' % ( params.project, params.target, params.configuration, params.sdk, params.code_sign_identity, params.provisioning_profile) createIPACommand = 'xcrun -sdk %s PackageApplication -v build/%s-iphoneos/%s.app -o %s' % (
# -*- coding: utf-8 -*- __author__ = 'Arms' ''' 上传ipa文件到SVN ''' import commands import os import urllib from config import qdSvnConfigs from common import ShellError, Dict, toDict, showMessage svnConfigs = toDict(qdSvnConfigs) def uploadipa(mode='test', ipapath=None): if not ipapath: raise StandardError('error! ipapath is empty') moveCommand = None svn_path = None svn_local_Path = None if mode == 'test': moveCommand = 'mv %s %s' % (ipapath, svnConfigs.test_local_path) svn_local_Path = svnConfigs.test_local_path svn_path = svnConfigs.test_svn_path elif mode == 'pro': moveCommand = 'mv %s %s' % (ipapath, svnConfigs.pro_local_path) svn_local_Path = svnConfigs.pro_local_path svn_path = svnConfigs.pro_svn_path os.chdir(svn_local_Path)
config.py ''' #import config_default import os.path import json import hashlib from common import toDict, merge path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'config') configs = None user = None with open('{}/config.json'.format(path), encoding='utf-8') as f: configs = json.load(f) with open('{}/user.json'.format(path), encoding='utf-8') as f: user = json.load(f) configs = merge(configs, user) configs = toDict(configs) usernames = None with open('{}/username.json'.format(path), encoding='utf-8') as f: usernames = json.load(f) for u in usernames: u['hashname'] = hashlib.sha256(u['username'].encode()).hexdigest() usernames = [toDict(u) for u in usernames]