當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。