当前位置: 首页>>代码示例>>Python>>正文


Python config.DOMAIN属性代码示例

本文整理汇总了Python中config.DOMAIN属性的典型用法代码示例。如果您正苦于以下问题:Python config.DOMAIN属性的具体用法?Python config.DOMAIN怎么用?Python config.DOMAIN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在config的用法示例。


在下文中一共展示了config.DOMAIN属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_from_dict

# 需要导入模块: import config [as 别名]
# 或者: from config import DOMAIN [as 别名]
def create_from_dict(cls, d, persist=True):
        new_employee = cls()
        new_employee.username = d['username']
        new_employee.user = users.User('{user}@{domain}'.format(user=new_employee.username, domain=config.DOMAIN))
        new_employee.update_from_dict(d)

        if persist is True:
            new_employee.put()

        return new_employee 
开发者ID:Yelp,项目名称:love,代码行数:12,代码来源:employee.py

示例2: wellknown_webfinger

# 需要导入模块: import config [as 别名]
# 或者: from config import DOMAIN [as 别名]
def wellknown_webfinger() -> Any:
    """Exposes/servers WebFinger data."""
    resource = request.args.get("resource")
    if resource not in [f"acct:{config.USERNAME}@{config.DOMAIN}", config.ID]:
        abort(404)

    out = {
        "subject": f"acct:{config.USERNAME}@{config.DOMAIN}",
        "aliases": [config.ID],
        "links": [
            {
                "rel": "http://webfinger.net/rel/profile-page",
                "type": "text/html",
                "href": config.ID,
            },
            {"rel": "self", "type": "application/activity+json", "href": config.ID},
            {
                "rel": "http://ostatus.org/schema/1.0/subscribe",
                "template": config.BASE_URL + "/authorize_follow?profile={uri}",
            },
            {"rel": "magic-public-key", "href": config.KEY.to_magic_key()},
            {
                "href": config.ICON_URL,
                "rel": "http://webfinger.net/rel/avatar",
                "type": mimetypes.guess_type(config.ICON_URL)[0],
            },
        ],
    }

    return jsonify(out, "application/jrd+json; charset=utf-8") 
开发者ID:tsileo,项目名称:microblog.pub,代码行数:32,代码来源:well_known.py

示例3: nodeinfo

# 需要导入模块: import config [as 别名]
# 或者: from config import DOMAIN [as 别名]
def nodeinfo() -> Any:
    """NodeInfo endpoint."""
    q = {
        "box": Box.OUTBOX.value,
        "meta.deleted": False,
        "type": {"$in": [ap.ActivityType.CREATE.value, ap.ActivityType.ANNOUNCE.value]},
    }

    out = {
        "version": "2.1",
        "software": {
            "name": "microblogpub",
            "version": config.VERSION,
            "repository": "https://github.com/tsileo/microblog.pub",
        },
        "protocols": ["activitypub"],
        "services": {"inbound": [], "outbound": []},
        "openRegistrations": False,
        "usage": {"users": {"total": 1}, "localPosts": DB.activities.count(q)},
        "metadata": {
            "nodeName": f"@{config.USERNAME}@{config.DOMAIN}",
            "version": config.VERSION,
            "versionDate": config.VERSION_DATE,
        },
    }

    return jsonify(
        out,
        "application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.1#",
    ) 
开发者ID:tsileo,项目名称:microblog.pub,代码行数:32,代码来源:well_known.py

示例4: gen_pic_url

# 需要导入模块: import config [as 别名]
# 或者: from config import DOMAIN [as 别名]
def gen_pic_url(path):
    if not path.startswith('/'):
        path = '/' + path
    return '{}{}'.format(DOMAIN, path) 
开发者ID:dongweiming,项目名称:weapp-zhihulive,代码行数:6,代码来源:schemas.py

示例5: run

# 需要导入模块: import config [as 别名]
# 或者: from config import DOMAIN [as 别名]
def run(self):
        # Set up logger
        logger = logging.getLogger()
        logger.setLevel(logging.INFO)
        formatter = logging.Formatter('[%(asctime)s %(levelname)s] %(message)s')
        if self._args['-d'] == None:
            handler = logging.StreamHandler()
        else:
            handler = logging.handlers.RotatingFileHandler(self._args['-l'],
                                                           maxBytes=1*1024*1024,
                                                           backupCount=1)
        handler.setFormatter(formatter)
        logger.addHandler(handler)

        bapi = BaseAPI(config.LOGIN_EMAIL, config.LOGIN_PASSWORD)
        dapi = DomainAPI(bapi)
        rapi = RecordAPI(bapi)
        domain = dapi.info(domain=config.DOMAIN)
        record_list = rapi.list(domain.id)
        record = None
        for rec in record_list:
            if rec.sub_domain == config.SUB_DOMAIN and \
               rec.record_type == Record.TYPE_A:
                record = rec
                break
        if record == None:
            logger.error("Couldn't get A record of domain: %s.%s",
                         config.SUB_DOMAIN, config.DOMAIN)
            return

        last_ip = record.value
        while True:
            try:
                current_ip = get_ip()
            except socket.error, e:
                logger.error('Get current IP error: %s', e)
            else:
                if current_ip != last_ip:
                    logger.info('IP change from %s to %s, update DNS record',
                                last_ip, current_ip)
                    rapi.ddns(record.domain_id, record.id, record.sub_domain,
                              record.record_line, current_ip)
                    last_ip = current_ip
                else:
                    logger.info('IP not change, check after %d seconds',
                                int(self._args['-t']))
            time.sleep(int(self._args['-t'])) 
开发者ID:leeyiw,项目名称:dnspod_ddns,代码行数:49,代码来源:dnspod_ddns.py


注:本文中的config.DOMAIN属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。