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


Python urls.urls方法代码示例

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


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

示例1: get_access_token

# 需要导入模块: import urls [as 别名]
# 或者: from urls import urls [as 别名]
def get_access_token(self):
        """
        ??access_token:{"access_token":"ACCESS_TOKEN","expires_in":7200}
        @return:
        """
        url = urls['access_token_request_url']
        app_id = self.app_id
        app_secret = self.app_secret
        grant_type = 'client_credential'
        request_url = url + '?grant_type=%s&appid=%s&secret=%s' % (grant_type, app_id, app_secret)

        try:
            request = urllib2.urlopen(request_url)
            response = request.read()
            result = json.loads(response)
            if result.get('access_token', False):
                return {'success': True, 'result': result}
            else:
                return {'success': False, 'msg': str(result)}
        except Exception as e:
            _logger.error(e.message)
            return {'success': False, 'msg': e.message} 
开发者ID:loginword,项目名称:odoo_wechat,代码行数:24,代码来源:wechat_official_account.py

示例2: create_media

# 需要导入模块: import urls [as 别名]
# 或者: from urls import urls [as 别名]
def create_media(self):
        """
        ???????????
        @return:
        """
        url = urls['upload_media_url'] + '?access_token=%s' % self.official_account_id.access_token
        data = dict()
        data['articles'] = []
        article = dict()
        article['title'] = self.title
        article['thumb_media_id'] = self.thumb_media_id
        article['author'] = self.author
        article['digest'] = self.digest
        article['show_cover_pic'] = self.show_cover_pic
        article['content'] = self.content
        article['content_source_url'] = self.content_source_url
        data['articles'].append(article)
        res = requests.request('post', url, data=json.dumps(data))
        result = res.json()
        self.media_id = result['media_id'] 
开发者ID:loginword,项目名称:odoo_wechat,代码行数:22,代码来源:wechat_media.py

示例3: __init__

# 需要导入模块: import urls [as 别名]
# 或者: from urls import urls [as 别名]
def __init__(self):
        print '\ninside Application __init__()'
        tornado.web.Application.__init__(self, urls, **settings)
        print 'Aapplication __init__ caleed with web.Application()'
        print 'returning from Application __init__' 
开发者ID:anirbanroydas,项目名称:rabbitChat,代码行数:7,代码来源:server.py

示例4: __init__

# 需要导入模块: import urls [as 别名]
# 或者: from urls import urls [as 别名]
def __init__(self):
        tornado.web.Application.__init__(self, urls, **settings) 
开发者ID:anirbanroydas,项目名称:rabbitChat,代码行数:4,代码来源:server.py

示例5: start

# 需要导入模块: import urls [as 别名]
# 或者: from urls import urls [as 别名]
def start():
    global application, server, ioloop
    application = Applicaton(urls, debug=setting.DEBUG, autoreload=setting.AUTORELOAD)
    server = HTTPServer(application)
    server.bind(5000)
    server.start()
    ioloop = IOLoop.instance()
    ioloop.add_callback(run)
    ioloop.add_callback(fetch_title)
    ioloop.add_callback(application.start)
    ioloop.start() 
开发者ID:cjhgo,项目名称:TelegramRelay,代码行数:13,代码来源:server.py

示例6: create_menu

# 需要导入模块: import urls [as 别名]
# 或者: from urls import urls [as 别名]
def create_menu(self):
        """
        ???????,??post,????????????????json??,??????????
        @return:
        """
        url = urls['menu_request_url']
        request_url = url + '?access_token=%s' % self.official_account_id.access_token
        post_data = self.parse_to_json_data()
        params = {'data': post_data.encode('utf-8')}
        res = requests.request('post', request_url, **params)
        return res.json() 
开发者ID:loginword,项目名称:odoo_wechat,代码行数:13,代码来源:wechat_menu.py

示例7: search_menu

# 需要导入模块: import urls [as 别名]
# 或者: from urls import urls [as 别名]
def search_menu(self):
        """
        ??????????,??????????
        @return:
        """
        url = urls['menu_request_url']
        request_url = url + '?access_token=%s' % self.official_account_id.access_token
        res = requests.request('get', request_url)
        menus = res.json()
        print menus
        return menus 
开发者ID:loginword,项目名称:odoo_wechat,代码行数:13,代码来源:wechat_menu.py

示例8: delete_menu

# 需要导入模块: import urls [as 别名]
# 或者: from urls import urls [as 别名]
def delete_menu(self):
        """
        ????????,???????
        @return:
        """
        url = urls['menu_delete_all_url']
        request_url = url + '?access_token=%s' % self.official_account_id.access_token
        res = requests.request('get', request_url)
        result = res.json()
        print result
        return result 
开发者ID:loginword,项目名称:odoo_wechat,代码行数:13,代码来源:wechat_menu.py

示例9: delete_conditional_menu

# 需要导入模块: import urls [as 别名]
# 或者: from urls import urls [as 别名]
def delete_conditional_menu(self):
        """
        ???????
        @return:
        """
        url = urls['menu_conditional_delete_url']
        request_url = url + '?access_token=%s' % self.official_account_id.access_token
        res = requests.request('post', request_url)
        result = res.json()
        print result
        return result 
开发者ID:loginword,项目名称:odoo_wechat,代码行数:13,代码来源:wechat_menu.py

示例10: delete_media

# 需要导入模块: import urls [as 别名]
# 或者: from urls import urls [as 别名]
def delete_media(self):
        """
        ??????
        @return:
        """
        url = urls['delete_media_url'] + '?access_token=%s' % self.official_account_id.access_token
        data = {'media_id': self.media_id}
        res = requests.request('post', url, data=json.dumps(data))
        data = res.json()
        print data 
开发者ID:loginword,项目名称:odoo_wechat,代码行数:12,代码来源:wechat_media.py


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