Code Duplication    Length = 10-10 lines in 2 locations

wechatpy/component.py 1 location

@@ 138-147 (lines=10) @@
135
        self.session = session or MemoryStorage()
136
        self.auto_retry = auto_retry
137
138
        if isinstance(session, six.string_types):
139
            from shove import Shove
140
            from wechatpy.session.shovestorage import ShoveStorage
141
142
            querystring = get_querystring(session)
143
            prefix = querystring.get('prefix', ['wechatpy'])[0]
144
145
            shove = Shove(session)
146
            storage = ShoveStorage(shove, prefix)
147
            self.session = storage
148
149
    @property
150
    def component_verify_ticket(self):

wechatpy/client/base.py 1 location

@@ 45-54 (lines=10) @@
42
        self.timeout = timeout
43
        self.auto_retry = auto_retry
44
45
        if isinstance(session, six.string_types):
46
            from shove import Shove
47
            from wechatpy.session.shovestorage import ShoveStorage
48
49
            querystring = get_querystring(session)
50
            prefix = querystring.get('prefix', ['wechatpy'])[0]
51
52
            shove = Shove(session)
53
            storage = ShoveStorage(shove, prefix)
54
            self.session = storage
55
56
        if access_token:
57
            self.session.set(self.access_token_key, access_token)