def peep_session(self): app = create_app() with app.app_context(): cookies = self.browser.cookies.all() return app.open_session(storify({'cookies': cookies}))
from jupiter.utils import get_repository_root from core.models.product.consts import P2P_TYPE from core.models.product.fund import Fund from core.models.product.p2p import P2P from core.models.product.insure import Insure fund = storify( dict( name=0, type=1, organization=2, code=3, found_date=4, index=5, risk=6, manager=7, year_rate=8, nickname=9, rec_reason=10, rec_rank=11, link=12, phone=13, )) p2p = storify( dict( name=0, organization=1, year_rate=2, pay_return_type=3,
from libs.cache import mc, cache, pcache from core.models.mixin.props import PropsMixin, PropsItem from solar.utils.storify import storify from .consts import VIEWPOINT, QUESTION, FUNDWEEKLY _ARTICLE_CACHE_PREFIX = 'article:' ARTICLE_CACHE_KEY = _ARTICLE_CACHE_PREFIX + '%s' ARTICLE_ALL_CACHE_KEY = _ARTICLE_CACHE_PREFIX + 'all:%s:%s' ARTICLE_ALL_TYPE_CACHE_KEY = _ARTICLE_CACHE_PREFIX + 'alltype:%s' ARTICLE_CATE_CACHE_KEY = _ARTICLE_CACHE_PREFIX + 'cate:%s:%s:%s' ARTICLE_COUNT_CACHE_KEY = _ARTICLE_CACHE_PREFIX + 'count:%s:%s' STATUS = storify(dict(NONE=0, PUBLISHED=1, DELETED=2)) class Article(PropsMixin): # need to add # kind is uuid # type is article type _const = {} kind = 'article' type = 'article' # admin record _add_admin = PropsItem('add_admin', '') _publish_admin = PropsItem('publish_admin', '') _delete_admin = PropsItem('delete_admin', '')
# coding: utf-8 from solar.utils.storify import storify ACCOUNT_STATUS = storify( dict( NEED_VERIFY='0', NORMAL='1', BANNED='2', FAILED='3', )) ACCOUNT_REG_TYPE = storify( dict( EMAIL='0', MOBILE='1', WEIXIN_OPENID='2', FIREWOOD_ID='3', # 新增抵扣金账户ID )) ACCOUNT_GENDER = storify(dict( UNKNOWN='0', FEMALE='1', MALE='2', )) VERIFY_CODE_TYPE = storify( dict( REG='1', FORGOT_PASSWORD_EMAIL='2', REG_MOBILE='3',
# -*- coding: utf-8 -*- ''' 全站或第三方合作开关配置,免得上线 ''' from solar.utils.storify import storify from core.models.mixin.props import SecretPropsMixin SETTINGS = storify(dict(XYZ='xyz_insure', )) class Settings(SecretPropsMixin): def __init__(self, settting_name): self.settting_name = settting_name def get_db(self): return 'settings' def get_uuid(self): return 'settings_%s' % self.settting_name @classmethod def get(cls, settting_name): assert settting_name in SETTINGS.values() return cls(settting_name) @property def settings(self): return self.data
import datetime import requests from xml.dom.minidom import parseString from more_itertools import chunked from solar.utils.storify import storify from libs.db.store import db from core.models.user.consts import ACCOUNT_REG_TYPE from core.models.hoard.order import OrderStatus as YixinOrderStatus from core.models.hoard.zhiwang import ZhiwangOrder # consts yimei_cdkey, yimei_pwd = '6SDK-EMY-6666-RDVMN', '206090' GROUPS = storify( dict(ALL='all_mobile_user', HOARDED='hoarded_user', IDENTIFIED='identified_mobile_user')) TEXTS = { GROUPS.HOARDED: '【好规划】亲爱滴用户,好规划网站升级维护成功。感谢您的耐心等待,送你一张加息券聊表歉意。http://dwz.cn/2pz6hF 退订回TD', GROUPS.IDENTIFIED: '【好规划】送你一份感恩礼物,感谢遇到了你。看看你的攒钱助手,有惊喜哦:)http://dwz.cn/2e2Huy 退订回TD' } def get_all_user_mobiles(): sql = 'select alias from account_alias where reg_type=%s' rs = db.execute(sql, ACCOUNT_REG_TYPE.MOBILE) return [r[0] for r in rs]
from core.models.utils import round_half_up SETTLED = 1 UNSETTLED = 0 DELETED = 1 REBATE_TYPE = storify(dict( RESERVE=1, TW=2, POOR=3, SOHU=4, MLR_CLOSURE_3=5, MLR_CLOSURE_6=6, MLR_CLOSURE_12=7, MLR_CLOSURE_9=8, MLR_ILLUMINATOR_3_15=9, MLR_ILLUMINATOR_9_15=10, MLR_ILLUMINATOR_12_15=11, PROMOTION=20, INVITE_REGISTER=30, # 邀请发送方 INVITE_INVEST_SENDER=31, # 邀请投资——发送方 INVITE_INVEST_ACCEPT=32, # 邀请投资——接受方 )) REBATE_TYPE_NAME_MAP = { REBATE_TYPE.RESERVE: u'预约福利', REBATE_TYPE.TW: u'双十二福利', REBATE_TYPE.POOR: u'比穷福利', REBATE_TYPE.SOHU: u'搜狐福利', REBATE_TYPE.MLR_CLOSURE_3: u'三月期礼券福利',
# -*- coding: utf-8 -*- import time from libs.cache import mc from libs.logger.rsyslog import rsyslog from solar.utils.storify import storify LIMIT = storify(dict( REGISTER='register:%s', # ip FORGOT_PASSWORD='******', # ip POST='post:%s', # ip MOBILE_REG='mobile_reg:%s', # mobile IP_MOBILE_REG='ip_mobile_reg:%s', # ip mobile BACKEND_MOBILE_SERVICE='backend_mobile_service:%s', MOBILE_BIND='mobile_bind:%s', # mobile binding IP_MOBILE_BIND='ip_mobile_bind:%s', # ip mobile binding MOBILE_WITHDRAW='mobile_withdraw:%s', IP_MOBILE_WITHDRAW='ip_mobile_withdraw:%s', USER_FETCH_ZW_LOANS='user_fetch_zw_loans:%s' )) def _log(msg): rsyslog.send(msg, tag='limit') class Limit(object): def __init__(self, key, timeout, limit):
RAW_DATA = storify( dict( gender=P(PlanValidateItem(default_values=GENDER_DEFAULT_VALUES), str), # 性别 age=P(PlanValidateRangeItem(value_range=ADULT_AGE_RANGE), str), # 年龄 career=P(PlanValidateItem(default_values=CAREER_DEFAULT_VALUES), str), # 职业 province=P(PlanLocValidateItem(), str), # 居住地 省份 city=P(PlanLocValidateItem(), str), # 居住地 城市 phone=P( PlanValidateItem(validate_method=validate_phone, force_input=False), str), # 电话 mine_society_insure=P( PlanValidateItem(default_values=SOCIETY_INSURE_DEFAULT_VALUES), str, '0'), # 我的社会保险 mine_biz_insure=P(PlanInsureValidateItem(), list, []), # 我的商业保险 spouse=P( PlanValidateItem(default_values=SPOUSE_DEFAULT_VALUES, force_input=False), str), # 有无配偶 spouse_age=P( PlanValidateRangeItem(value_range=ADULT_AGE_RANGE, force_input=False), str), # 配偶年龄 spouse_career=P( PlanValidateItem(default_values=SPOUSE_CAREER_DEFAULT_VALUES, force_input=False), str), # 配偶工作 spouse_society_insure=P( PlanValidateItem(default_values=SOCIETY_INSURE_DEFAULT_VALUES, force_input=False), str, '0'), # 配偶的社会保险 spouse_biz_insure=P(PlanInsureValidateItem(), list, []), # 配偶的商业保险 children=P(PlanChildrenValidateItem(), list, []), # 子女 income_month_salary=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 每月工资收入 income_month_extra=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 每月其他收入 income_year_bonus=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 年终奖 income_year_extra=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 其他年收入 spouse_income_month_salary=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 配偶每月工资收入 spouse_income_month_extra=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 配偶每月其他收入 spouse_income_year_bonus=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 配偶年终奖 spouse_income_year_extra=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 配偶其他年收入 expend_month_ent=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 每月餐饮娱乐 expend_month_trans=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 每月交通通讯 expend_month_shopping=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 每月家居购物 expend_month_house=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 每月房租房贷 expend_month_extra=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 每月其他支出 expend_year_extra=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 其他年度支出 deposit_current=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 现金及活期存款 deposit_fixed=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 定期存款 funds_money=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 货币基金/余额宝 funds_index=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 指数型基金 funds_hybrid=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 混合型基金 funds_bond=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 债券型基金 funds_stock=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 股票型基金 funds_other=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 其他基金 invest_bank=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 银行理财产品 invest_stock=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 股票 invest_national_debt=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 国债 invest_p2p=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # p2p网贷 invest_insure=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 储蓄型保险 invest_metal=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 贵金属 invest_other=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 其他金融资产 consumer_loans=P( PlanValidateRangeItemWithZero(value_range=DEFAUT_MONEY_RANGE, force_input=False), int, 0), # 信用卡债/消费贷款 real_estate_value=P( PlanValidateRangeItemWithZero(value_range=REAL_PROPERTY_RANGE, force_input=False), int, 0), # 房产市值 real_estate_loan=P( PlanValidateRangeItemWithZero(value_range=REAL_PROPERTY_RANGE, force_input=False), int, 0), # 未还房贷 car_value=P( PlanValidateRangeItemWithZero(value_range=REAL_PROPERTY_RANGE, force_input=False), int, 0), # 汽车价值 real_collection_value=P( PlanValidateRangeItemWithZero(value_range=REAL_PROPERTY_RANGE, force_input=False), int, 0), # 收藏品 real_other_value=P( PlanValidateRangeItemWithZero(value_range=REAL_PROPERTY_RANGE, force_input=False), int, 0), # 其他实物资产 target=P(PlanTargetValidateItem(), list, []), # 目标 invest_exp=P( PlanValidateItem(force_input=True, default_values=INVEST_EXP_DEFAULT_VALUES), str), # 经验年数 invest_concern=P( PlanValidateItem(force_input=True, default_values=INVEST_CONCERN_DEFAULT_VALUES), str), # 投资时主要考虑 invest_increase=P( PlanValidateItem(force_input=True, default_values=INVEST_RISK_RAGE_DEFAULT_VALUES), str), # 波动范围 invest_handle=P( PlanValidateItem(force_input=True, default_values=INVEST_HANDLE_DEFAULT_VALUES), str), # 亏损后应对 ))
# -*- coding: utf-8 -*- from solar.utils.storify import storify # Do not use this direct VIEWPOINT_CATEGORY = { '10000': '理财课堂', '10001': '产品评测', '10002': '投资机会', '10003': '风险提示', '10004': '理财周报', '10005': '我问理财师', } TOPIC_CATEGORY = {} QUESTION_CATEGORY = {} FUNDWEEKLY_CATEGORY = { '1': '主题精选', '2': '稳拿计划', } # Use these as article consts VIEWPOINT = storify(dict(KIND='viewpoint', TYPE=1, CATEGORY=VIEWPOINT_CATEGORY)) TOPIC = storify(dict(KIND='topic', TYPE=2, CATEGORY=TOPIC_CATEGORY)) QUESTION = storify(dict(KIND='question', TYPE=3, CATEGORY=QUESTION_CATEGORY)) FUNDWEEKLY = storify( dict(KIND='fundweekly', TYPE=4, CATEGORY=FUNDWEEKLY_CATEGORY))
# -*- coding: utf-8 -*- from solar.utils.storify import storify RISK_RANK = storify(dict(LOW='1', MEDIUM='2', HIGH='3')) RECOMMEND_RANK = storify(dict(ONE=1, TWO=2, THREE=3, FOUR=4, FIVE=5)) PRODUCT_STATUS = storify(dict(ON='0', OFF='1')) P2P_TYPE = storify(dict(P2P='1')) BANK_TYPE = storify(dict(BANK='1')) DEBT_TYPE = storify(dict(CERTIFICATE='1')) FUND_TYPE = storify( dict( MMF='1', # Money market fund 货币基金 BOND='2', # 债券型基金 INDEX='3', # 指数型基金 STOCK='4')) # 股票型基金 FUND_NAME = storify( dict( MMF='货币型基金', # Money market fund 货币基金 BOND='债券型基金', # 债券型基金 INDEX='指数型基金', # 指数型基金 STOCK='股票型基金')) # 股票型基金 INSURE_TYPE = storify(