Completed
Pull Request — master (#216)
by
unknown
03:34
created

MerchantCategory   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 45.45%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
dl 0
loc 27
ccs 5
cts 11
cp 0.4545
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A get_sub_categories() 0 7 2
A get_properties() 0 7 2
A get_sku_list() 0 7 2
1
# -*- coding: utf-8 -*-
2 10
from __future__ import absolute_import, unicode_literals
3 10
from wechatpy.client.api.base import BaseWeChatAPI
4
5
6 10
class MerchantCategory(BaseWeChatAPI):
7
8 10
    API_BASE_URL = 'https://api.weixin.qq.com/'
9
    
10 10
    def get_sub_categories(self, cate_id):
11
        res = self._post(
12
            'merchant/category/getsub',
13
            data={'cate_id': cate_id},
14
            result_processor=lambda x: x['cate_list']
15
        )
16
        return res
17
18 10
    def get_sku_list(self, cate_id):
19
        res = self._post(
20
            'merchant/category/getsku',
21
            data={'cate_id': cate_id},
22
            result_processor=lambda x: x['sku_table']
23
        )
24
        return res
25
26 10
    def get_properties(self, cate_id):
27
        res = self._post(
28
            'merchant/category/getproperty',
29
            data={'cate_id': cate_id},
30
            result_processor=lambda x: x['properties']
31
        )
32
        return res
33