Code Duplication    Length = 10-11 lines in 2 locations

tests/test_btcde_func.py 1 location

@@ 22-32 (lines=11) @@
19
        data = json.load(open(filepath))
20
        return data
21
22
    def sortParams(self, url, params={}):
23
        '''To sort params for url string.'''
24
        self.encoded_string = ''
25
        if len(params) > 0:
26
            for key, value in sorted(params.items()):
27
                self.encoded_string += str(key) + '=' + str(value) + '&'
28
            self.encoded_string = self.encoded_string[:-1]
29
            self.url = url + '?' + self.encoded_string
30
        else:
31
            self.url = url
32
        return self.url, self.encoded_string
33
34
    def verifySignature(self, url, method, params):
35
        '''To verify API Signature.'''

btcde.py 1 location

@@ 56-65 (lines=10) @@
53
        if value not in list:
54
            list_string = ', '.join(str(x) for x in list)
55
            raise ValueError("{} is not any of {}".format(value, list_string))
56
57
    def create_url(self, uri):
58
        if self.params:
59
            self.encoded_string = ''
60
            for key, value in sorted(self.params.items()):
61
                self.encoded_string += str(key) + '=' + str(value) + '&'
62
            self.encoded_string = self.encoded_string[:-1]
63
            self.url = uri + '?' + self.encoded_string
64
        else:
65
            self.encoded_string = ''
66
            self.url = uri
67
68