Completed
Push — master ( e6b198...e30f90 )
by Messense
11:09 queued 10:06
created

MerchantCommon.upload_image()   A

Complexity

Conditions 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 3.1852
Metric Value
cc 2
dl 0
loc 10
ccs 1
cts 3
cp 0.3333
crap 3.1852
rs 9.4285
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 MerchantCommon(BaseWeChatAPI):
7
8 10
    def upload_image(self, filename, image_data):
9
        res = self._post(
10
            'merchant/common/upload_img',
11
            params={
12
                'filename': filename
13
            },
14
            data=image_data,
15
            result_processor=lambda x: x['image_url']
16
        )
17
        return res
18