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

MerchantCategory.get_properties()   A

Complexity

Conditions 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 3.1852

Importance

Changes 0
Metric Value
cc 2
dl 0
loc 7
ccs 1
cts 3
cp 0.3333
crap 3.1852
rs 9.4285
c 0
b 0
f 0
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