From 2c30fdfd1797d0a93608cedf3732d80351d22637 Mon Sep 17 00:00:00 2001 From: Inso <insomniak.fr@gmail.com> Date: Thu, 22 Jan 2015 22:31:01 +0100 Subject: [PATCH] Various bug fixes --- ucoinpy/api/bma/__init__.py | 6 ++++-- ucoinpy/documents/block.py | 5 +++-- ucoinpy/documents/certification.py | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ucoinpy/api/bma/__init__.py b/ucoinpy/api/bma/__init__.py index 02fac8a9..768bd447 100644 --- a/ucoinpy/api/bma/__init__.py +++ b/ucoinpy/api/bma/__init__.py @@ -109,7 +109,8 @@ class API(object): - `path`: the request path """ - response = requests.get(self.reverse_url(path), params=kwargs, headers=self.headers) + response = requests.get(self.reverse_url(path), params=kwargs, + headers=self.headers, timeout=15) if response.status_code != 200: raise ValueError('status code != 200 => %d (%s)' % (response.status_code, response.text)) @@ -127,7 +128,8 @@ class API(object): kwargs['self'] = kwargs.pop('self_') logging.debug("POST : {0}".format(kwargs)) - response = requests.post(self.reverse_url(path), data=kwargs, headers=self.headers) + response = requests.post(self.reverse_url(path), data=kwargs, headers=self.headers, + timeout=15) if response.status_code != 200: raise ValueError('status code != 200 => %d (%s)' % (response.status_code, response.text)) diff --git a/ucoinpy/documents/block.py b/ucoinpy/documents/block.py index 873f404d..6a023cd6 100644 --- a/ucoinpy/documents/block.py +++ b/ucoinpy/documents/block.py @@ -73,6 +73,7 @@ BOTTOM_SIGNATURE re_actives = re.compile("Actives:\n") re_leavers = re.compile("Leavers:\n") re_excluded = re.compile("Excluded:\n") + re_exclusion = re.compile("([1-9A-Za-z][^OIl]{42,45})\n") re_certifications = re.compile("Certifications:\n") re_transactions = re.compile("Transactions:\n") @@ -197,7 +198,7 @@ BOTTOM_SIGNATURE if Block.re_excluded.match(lines[n]): n = n + 1 while Block.re_certifications.match(lines[n]) is None: - membership = Membership.from_inline(version, currency, "OUT", lines[n]) + membership = Block.re_exclusion.match(lines[n]).group(1) excluded.append(membership) n = n + 1 @@ -282,7 +283,7 @@ PreviousIssuer: {1}\n".format(self.prev_hash, self.prev_issuer) doc += "Excluded:\n" for exclude in self.excluded: - doc += "{0}\n".format(exclude.inline()) + doc += "{0}\n".format(exclude) doc += "Certifications:\n" for cert in self.certifications: diff --git a/ucoinpy/documents/certification.py b/ucoinpy/documents/certification.py index 79f6d11f..ce5eff0e 100644 --- a/ucoinpy/documents/certification.py +++ b/ucoinpy/documents/certification.py @@ -57,7 +57,7 @@ class Certification(Document): re_timestamp = re.compile("META:TS:([0-9]+)-([0-9a-fA-F]{5,40})\n") def __init__(self, version, currency, pubkey_from, pubkey_to, - blockhash, blocknumber, signature): + blocknumber, blockhash, signature): ''' Constructor ''' -- GitLab