hive-nectar 0.0.6__py3-none-any.whl → 0.0.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of hive-nectar might be problematic. Click here for more details.

Files changed (47) hide show
  1. {hive_nectar-0.0.6.dist-info → hive_nectar-0.0.7.dist-info}/METADATA +5 -3
  2. {hive_nectar-0.0.6.dist-info → hive_nectar-0.0.7.dist-info}/RECORD +46 -47
  3. nectar/account.py +43 -47
  4. nectar/amount.py +6 -11
  5. nectar/block.py +8 -9
  6. nectar/blockchain.py +4 -5
  7. nectar/blockchaininstance.py +4 -4
  8. nectar/blockchainobject.py +5 -6
  9. nectar/blurt.py +3 -4
  10. nectar/cli.py +14 -14
  11. nectar/comment.py +10 -11
  12. nectar/community.py +4 -5
  13. nectar/conveyor.py +3 -4
  14. nectar/exceptions.py +30 -24
  15. nectar/hive.py +3 -4
  16. nectar/hivesigner.py +2 -2
  17. nectar/imageuploader.py +2 -3
  18. nectar/price.py +6 -13
  19. nectar/rc.py +1 -2
  20. nectar/steem.py +3 -4
  21. nectar/transactionbuilder.py +12 -3
  22. nectar/version.py +1 -1
  23. nectar/vote.py +8 -9
  24. nectar/wallet.py +1 -1
  25. nectarapi/exceptions.py +20 -14
  26. nectarapi/version.py +1 -1
  27. nectarbase/ledgertransactions.py +2 -3
  28. nectarbase/memo.py +9 -10
  29. nectarbase/objects.py +4 -5
  30. nectarbase/operations.py +3 -7
  31. nectarbase/version.py +1 -1
  32. nectargraphenebase/__init__.py +0 -1
  33. nectargraphenebase/account.py +16 -37
  34. nectargraphenebase/base58.py +5 -8
  35. nectargraphenebase/bip32.py +5 -11
  36. nectargraphenebase/bip38.py +6 -7
  37. nectargraphenebase/ecdsasig.py +32 -37
  38. nectargraphenebase/objects.py +6 -7
  39. nectargraphenebase/signedtransactions.py +10 -9
  40. nectargraphenebase/types.py +9 -19
  41. nectargraphenebase/unsignedtransactions.py +21 -28
  42. nectargraphenebase/version.py +1 -1
  43. nectarstorage/masterpassword.py +2 -3
  44. nectargraphenebase/py23.py +0 -38
  45. {hive_nectar-0.0.6.dist-info → hive_nectar-0.0.7.dist-info}/WHEEL +0 -0
  46. {hive_nectar-0.0.6.dist-info → hive_nectar-0.0.7.dist-info}/entry_points.txt +0 -0
  47. {hive_nectar-0.0.6.dist-info → hive_nectar-0.0.7.dist-info}/licenses/LICENSE.txt +0 -0
nectar/blockchain.py CHANGED
@@ -5,13 +5,13 @@ import logging
5
5
  import math
6
6
  import time
7
7
  from datetime import timedelta
8
+ from queue import Queue
8
9
  from threading import Event, Thread
9
10
  from time import sleep
10
11
 
11
12
  import nectar as stm
12
13
  from nectar.instance import shared_blockchain_instance
13
14
  from nectarapi.exceptions import UnknownTransaction
14
- from nectargraphenebase.py23 import py23_bytes
15
15
 
16
16
  from .block import Block, BlockHeader
17
17
  from .exceptions import (
@@ -23,12 +23,11 @@ from .exceptions import (
23
23
  from .utils import addTzInfo
24
24
 
25
25
  log = logging.getLogger(__name__)
26
- from queue import Queue
27
26
 
28
27
  FUTURES_MODULE = None
29
28
  if not FUTURES_MODULE:
30
29
  try:
31
- from concurrent.futures import ThreadPoolExecutor, as_completed, wait
30
+ from concurrent.futures import ThreadPoolExecutor, as_completed
32
31
 
33
32
  FUTURES_MODULE = "futures"
34
33
  # FUTURES_MODULE = None
@@ -339,7 +338,7 @@ class Blockchain(object):
339
338
  >>> from datetime import datetime
340
339
  >>> blockchain = Blockchain()
341
340
  >>> block_num = blockchain.get_estimated_block_num(datetime(2019, 6, 18, 5 ,8, 27))
342
- >>> block_num == 33898184
341
+ >>> block_num == 33898182
343
342
  True
344
343
 
345
344
  """
@@ -961,7 +960,7 @@ class Blockchain(object):
961
960
  op = event["value"]
962
961
  event = [op_type, op]
963
962
  data = json.dumps(event, sort_keys=True)
964
- return hashlib.sha1(py23_bytes(data, "utf-8")).hexdigest()
963
+ return hashlib.sha1(bytes(data, "utf-8")).hexdigest()
965
964
 
966
965
  def get_all_accounts(self, start="", stop="", steps=1e3, limit=-1, **kwargs):
967
966
  """Yields account names between start and stop.
@@ -328,7 +328,7 @@ class BlockChainInstance(object):
328
328
  self.data["last_node"] = self.rpc.url
329
329
  try:
330
330
  self.data["feed_history"] = self.get_feed_history(False)
331
- except:
331
+ except Exception:
332
332
  self.data["feed_history"] = None
333
333
  self.data["get_feed_history"] = self.data["feed_history"]
334
334
  elif chain_property == "hardfork_properties":
@@ -348,7 +348,7 @@ class BlockChainInstance(object):
348
348
  self.data["last_node"] = self.rpc.url
349
349
  try:
350
350
  self.data["hardfork_properties"] = self.get_hardfork_properties(False)
351
- except:
351
+ except Exception:
352
352
  self.data["hardfork_properties"] = None
353
353
  elif chain_property == "witness_schedule":
354
354
  if not self.offline:
@@ -430,7 +430,7 @@ class BlockChainInstance(object):
430
430
  "current_reserve_ratio": props["current_reserve_ratio"],
431
431
  "max_virtual_bandwidth": props["max_virtual_bandwidth"],
432
432
  }
433
- except:
433
+ except Exception:
434
434
  reserve_ratio = {
435
435
  "id": 0,
436
436
  "average_block_size": None,
@@ -541,7 +541,7 @@ class BlockChainInstance(object):
541
541
  return None
542
542
  try:
543
543
  return self.rpc.get_network(props=config)
544
- except:
544
+ except Exception:
545
545
  return known_chains["HIVE"]
546
546
 
547
547
  def get_median_price(self, use_stored_data=True):
@@ -4,7 +4,6 @@ import threading
4
4
  from datetime import datetime, timedelta, timezone
5
5
 
6
6
  from nectar.instance import shared_blockchain_instance
7
- from nectargraphenebase.py23 import integer_types, string_types
8
7
 
9
8
 
10
9
  class ObjectCache(dict):
@@ -115,7 +114,7 @@ class BlockchainObject(dict):
115
114
  if isinstance(data, (list, set, tuple)):
116
115
  raise ValueError("Cannot interpret lists! Please load elements individually!")
117
116
 
118
- if id_item and isinstance(id_item, string_types):
117
+ if id_item and isinstance(id_item, str):
119
118
  self.id_item = id_item
120
119
  else:
121
120
  self.id_item = "id"
@@ -125,7 +124,7 @@ class BlockchainObject(dict):
125
124
  elif isinstance(data, dict):
126
125
  self.identifier = data.get(self.id_item)
127
126
  super(BlockchainObject, self).__init__(data)
128
- elif isinstance(data, integer_types):
127
+ elif isinstance(data, int):
129
128
  # This is only for block number basically
130
129
  self.identifier = data
131
130
  if not lazy and not self.cached:
@@ -134,7 +133,7 @@ class BlockchainObject(dict):
134
133
  self[self.id_item] = data
135
134
  # Set identifier again as it is overwritten in super() in refresh()
136
135
  self.identifier = data
137
- elif isinstance(data, string_types):
136
+ elif isinstance(data, str):
138
137
  self.identifier = data
139
138
  if not lazy and not self.cached:
140
139
  self.refresh()
@@ -159,9 +158,9 @@ class BlockchainObject(dict):
159
158
  BlockchainObject._cache = ObjectCache()
160
159
 
161
160
  def test_valid_objectid(self, i):
162
- if isinstance(i, string_types):
161
+ if isinstance(i, str):
163
162
  return True
164
- elif isinstance(i, integer_types):
163
+ elif isinstance(i, int):
165
164
  return True
166
165
  else:
167
166
  return False
nectar/blurt.py CHANGED
@@ -6,7 +6,6 @@ from datetime import date, datetime, timezone
6
6
  from nectar.blockchaininstance import BlockChainInstance
7
7
  from nectar.constants import STEEM_100_PERCENT, STEEM_VOTE_REGENERATION_SECONDS
8
8
  from nectargraphenebase.chains import known_chains
9
- from nectargraphenebase.py23 import string_types
10
9
 
11
10
  from .amount import Amount
12
11
  from .utils import formatToTimeStamp
@@ -124,7 +123,7 @@ class Blurt(BlockChainInstance):
124
123
  return known_chains["BLURT"]
125
124
  try:
126
125
  return self.rpc.get_network(props=config)
127
- except:
126
+ except Exception:
128
127
  return known_chains["BLURT"]
129
128
 
130
129
  def rshares_to_token_backed_dollar(
@@ -378,7 +377,7 @@ class Blurt(BlockChainInstance):
378
377
  """
379
378
  if isinstance(sbd, Amount):
380
379
  sbd = Amount(sbd, blockchain_instance=self)
381
- elif isinstance(sbd, string_types):
380
+ elif isinstance(sbd, str):
382
381
  sbd = Amount(sbd, blockchain_instance=self)
383
382
  else:
384
383
  sbd = Amount(sbd, self.token_symbol, blockchain_instance=self)
@@ -502,7 +501,7 @@ class Blurt(BlockChainInstance):
502
501
  """
503
502
  if isinstance(sbd, Amount):
504
503
  sbd = Amount(sbd, blockchain_instance=self)
505
- elif isinstance(sbd, string_types):
504
+ elif isinstance(sbd, str):
506
505
  sbd = Amount(sbd, blockchain_instance=self)
507
506
  else:
508
507
  sbd = Amount(sbd, self.token_symbol, blockchain_instance=self)
nectar/cli.py CHANGED
@@ -151,7 +151,7 @@ def unlock_wallet(stm, password=None, allow_wif=True):
151
151
  if stm.wallet.is_encrypted():
152
152
  try:
153
153
  stm.wallet.unlock(password)
154
- except:
154
+ except Exception:
155
155
  try:
156
156
  from nectarstorage import InRamPlainKeyStore
157
157
 
@@ -159,7 +159,7 @@ def unlock_wallet(stm, password=None, allow_wif=True):
159
159
  stm.wallet.setKeys([password])
160
160
  print("Wif accepted!")
161
161
  return True
162
- except:
162
+ except Exception:
163
163
  if allow_wif:
164
164
  raise exceptions.WrongMasterPasswordException(
165
165
  "entered password is not a valid password/wif"
@@ -173,13 +173,13 @@ def unlock_wallet(stm, password=None, allow_wif=True):
173
173
  stm.wallet.setKeys([password])
174
174
  print("Wif accepted!")
175
175
  return True
176
- except:
176
+ except Exception:
177
177
  try:
178
178
  from nectarstorage import SqliteEncryptedKeyStore
179
179
 
180
180
  stm.wallet.store = SqliteEncryptedKeyStore(config=stm.config)
181
181
  stm.wallet.unlock(password)
182
- except:
182
+ except Exception:
183
183
  if allow_wif:
184
184
  raise exceptions.WrongMasterPasswordException(
185
185
  "entered password is not a valid password/wif"
@@ -231,7 +231,7 @@ def unlock_token_wallet(stm, sc2, password=None):
231
231
  )
232
232
  try:
233
233
  sc2.unlock(password)
234
- except:
234
+ except Exception:
235
235
  raise exceptions.WrongMasterPasswordException(
236
236
  "entered password is not a valid password"
237
237
  )
@@ -1539,7 +1539,7 @@ def powerup(amount, account, to, export):
1539
1539
  acc = Account(account, blockchain_instance=stm)
1540
1540
  try:
1541
1541
  amount = float(amount)
1542
- except:
1542
+ except Exception:
1543
1543
  amount = str(amount)
1544
1544
  tx = acc.transfer_to_vesting(amount, to=to)
1545
1545
  if stm.unsigned and stm.nobroadcast and stm.steemconnect is not None:
@@ -1570,7 +1570,7 @@ def powerdown(amount, account, export):
1570
1570
  acc = Account(account, blockchain_instance=stm)
1571
1571
  try:
1572
1572
  amount = float(amount)
1573
- except:
1573
+ except Exception:
1574
1574
  amount = str(amount)
1575
1575
  tx = acc.withdraw_vesting(amount)
1576
1576
  if stm.unsigned and stm.nobroadcast and stm.steemconnect is not None:
@@ -1602,7 +1602,7 @@ def delegate(amount, to_account, account, export):
1602
1602
  acc = Account(account, blockchain_instance=stm)
1603
1603
  try:
1604
1604
  amount = float(amount)
1605
- except:
1605
+ except Exception:
1606
1606
  amount = Amount(str(amount), blockchain_instance=stm)
1607
1607
  if amount.symbol == stm.token_symbol and isinstance(stm, Steem):
1608
1608
  amount = stm.sp_to_vests(float(amount))
@@ -1747,7 +1747,7 @@ def convert(amount, account, export):
1747
1747
  acc = Account(account, blockchain_instance=stm)
1748
1748
  try:
1749
1749
  amount = float(amount)
1750
- except:
1750
+ except Exception:
1751
1751
  amount = str(amount)
1752
1752
  tx = acc.convert(amount)
1753
1753
  if stm.unsigned and stm.nobroadcast and stm.steemconnect is not None:
@@ -2760,7 +2760,7 @@ def decrypt(memo, account, output, info, text, binary):
2760
2760
  else:
2761
2761
  print("to: %s" % str(to_key))
2762
2762
  print("nonce: %s" % nonce)
2763
- except:
2763
+ except Exception:
2764
2764
  print("from: %s" % str(from_key))
2765
2765
  print("to: %s" % str(to_key))
2766
2766
  print("nonce: %s" % nonce)
@@ -3031,7 +3031,7 @@ def createpost(
3031
3031
  community = input("community account (name or title): ")
3032
3032
  try:
3033
3033
  community = Community(community)
3034
- except:
3034
+ except Exception:
3035
3035
  c = Communities(limit=1000)
3036
3036
  comm_cand = c.search_title(community)
3037
3037
  if len(comm_cand) == 0:
@@ -3264,7 +3264,7 @@ def post(
3264
3264
  if permlink is not None:
3265
3265
  try:
3266
3266
  comment = Comment(construct_authorperm(author, permlink), blockchain_instance=stm)
3267
- except:
3267
+ except Exception:
3268
3268
  comment = None
3269
3269
  else:
3270
3270
  comment = None
@@ -3291,7 +3291,7 @@ def post(
3291
3291
  permlink = derive_permlink(title, with_suffix=False)
3292
3292
  try:
3293
3293
  comment = Comment(construct_authorperm(author, permlink), blockchain_instance=stm)
3294
- except:
3294
+ except Exception:
3295
3295
  comment = None
3296
3296
  if comment is None:
3297
3297
  json_metadata = {}
@@ -5768,7 +5768,7 @@ def info(objects):
5768
5768
  Amount(median_price["base"], blockchain_instance=stm).amount
5769
5769
  / Amount(median_price["quote"], blockchain_instance=stm).amount
5770
5770
  )
5771
- except:
5771
+ except Exception:
5772
5772
  price = None
5773
5773
  for key in info:
5774
5774
  if isinstance(info[key], dict) and "amount" in info[key]:
nectar/comment.py CHANGED
@@ -10,7 +10,6 @@ from nectar.constants import (
10
10
  STEEM_REVERSE_AUCTION_WINDOW_SECONDS_HF21,
11
11
  )
12
12
  from nectarbase import operations
13
- from nectargraphenebase.py23 import bytes_types, integer_types, string_types
14
13
 
15
14
  from .account import Account
16
15
  from .amount import Amount
@@ -74,7 +73,7 @@ class Comment(BlockchainObject):
74
73
  elif kwargs.get("hive_instance"):
75
74
  blockchain_instance = kwargs["hive_instance"]
76
75
  self.blockchain = blockchain_instance or shared_blockchain_instance()
77
- if isinstance(authorperm, string_types) and authorperm != "":
76
+ if isinstance(authorperm, str) and authorperm != "":
78
77
  [author, permlink] = resolve_authorperm(authorperm)
79
78
  self["id"] = 0
80
79
  self["author"] = author
@@ -104,7 +103,7 @@ class Comment(BlockchainObject):
104
103
  "max_cashout_time",
105
104
  ]
106
105
  for p in parse_times:
107
- if p in comment and isinstance(comment.get(p), string_types):
106
+ if p in comment and isinstance(comment.get(p), str):
108
107
  comment[p] = formatTimeString(comment.get(p, "1970-01-01T00:00:00"))
109
108
  # Parse Amounts
110
109
  sbd_amounts = [
@@ -116,7 +115,7 @@ class Comment(BlockchainObject):
116
115
  "promoted",
117
116
  ]
118
117
  for p in sbd_amounts:
119
- if p in comment and isinstance(comment.get(p), (string_types, list, dict)):
118
+ if p in comment and isinstance(comment.get(p), (str, list, dict)):
120
119
  value = comment.get(p, "0.000 %s" % (self.blockchain.backed_token_symbol))
121
120
  if (
122
121
  isinstance(value, str)
@@ -129,7 +128,7 @@ class Comment(BlockchainObject):
129
128
  meta_str = comment.get("json_metadata", "{}")
130
129
  if meta_str == "{}":
131
130
  comment["json_metadata"] = meta_str
132
- if isinstance(meta_str, (string_types, bytes_types, bytearray)):
131
+ if isinstance(meta_str, (str, bytes, bytearray)):
133
132
  try:
134
133
  comment["json_metadata"] = json.loads(meta_str)
135
134
  except Exception:
@@ -147,20 +146,20 @@ class Comment(BlockchainObject):
147
146
  "net_rshares",
148
147
  ]
149
148
  for p in parse_int:
150
- if p in comment and isinstance(comment.get(p), string_types):
149
+ if p in comment and isinstance(comment.get(p), str):
151
150
  comment[p] = int(comment.get(p, "0"))
152
151
 
153
152
  if "active_votes" in comment:
154
153
  new_active_votes = []
155
154
  for vote in comment["active_votes"]:
156
- if "time" in vote and isinstance(vote.get("time"), string_types):
155
+ if "time" in vote and isinstance(vote.get("time"), str):
157
156
  vote["time"] = formatTimeString(vote.get("time", "1970-01-01T00:00:00"))
158
157
  parse_int = [
159
158
  "rshares",
160
159
  "reputation",
161
160
  ]
162
161
  for p in parse_int:
163
- if p in vote and isinstance(vote.get(p), string_types):
162
+ if p in vote and isinstance(vote.get(p), str):
164
163
  try:
165
164
  vote[p] = int(vote.get(p, "0"))
166
165
  except ValueError:
@@ -263,7 +262,7 @@ class Comment(BlockchainObject):
263
262
  "net_rshares",
264
263
  ]
265
264
  for p in parse_int:
266
- if p in output and isinstance(output[p], integer_types):
265
+ if p in output and isinstance(output[p], int):
267
266
  output[p] = str(output[p])
268
267
  if "active_votes" in output:
269
268
  new_active_votes = []
@@ -279,7 +278,7 @@ class Comment(BlockchainObject):
279
278
  "reputation",
280
279
  ]
281
280
  for p in parse_int:
282
- if p in vote and isinstance(vote[p], integer_types):
281
+ if p in vote and isinstance(vote[p], int):
283
282
  vote[p] = str(vote[p])
284
283
  new_active_votes.append(vote)
285
284
  output["active_votes"] = new_active_votes
@@ -685,7 +684,7 @@ class Comment(BlockchainObject):
685
684
  )
686
685
  elif pending_payout_value is None:
687
686
  pending_payout_value = 0
688
- elif isinstance(pending_payout_value, (float, integer_types)):
687
+ elif isinstance(pending_payout_value, (float, int)):
689
688
  pending_payout_value = Amount(
690
689
  pending_payout_value,
691
690
  self.blockchain.backed_token_symbol,
nectar/community.py CHANGED
@@ -6,7 +6,6 @@ from datetime import date, datetime, time
6
6
  from prettytable import PrettyTable
7
7
 
8
8
  from nectar.instance import shared_blockchain_instance
9
- from nectargraphenebase.py23 import integer_types, string_types
10
9
 
11
10
  from .blockchainobject import BlockchainObject
12
11
  from .exceptions import AccountDoesNotExistsException, OfflineHasNoRPCException
@@ -118,11 +117,11 @@ class Community(BlockchainObject):
118
117
  "num_authors",
119
118
  ]
120
119
  for p in parse_int:
121
- if p in community and isinstance(community.get(p), string_types):
120
+ if p in community and isinstance(community.get(p), str):
122
121
  community[p] = int(community.get(p, 0))
123
122
  parse_times = ["created_at"]
124
123
  for p in parse_times:
125
- if p in community and isinstance(community.get(p), string_types):
124
+ if p in community and isinstance(community.get(p), str):
126
125
  community[p] = addTzInfo(
127
126
  datetime.strptime(community.get(p, "1970-01-01 00:00:00"), "%Y-%m-%d %H:%M:%S")
128
127
  )
@@ -138,10 +137,10 @@ class Community(BlockchainObject):
138
137
  ]
139
138
  parse_int_without_zero = []
140
139
  for p in parse_int:
141
- if p in output and isinstance(output[p], integer_types):
140
+ if p in output and isinstance(output[p], int):
142
141
  output[p] = str(output[p])
143
142
  for p in parse_int_without_zero:
144
- if p in output and isinstance(output[p], integer_types) and output[p] != 0:
143
+ if p in output and isinstance(output[p], int) and output[p] != 0:
145
144
  output[p] = str(output[p])
146
145
 
147
146
  parse_times = [
nectar/conveyor.py CHANGED
@@ -10,7 +10,6 @@ from datetime import datetime, timezone
10
10
  import requests
11
11
 
12
12
  from nectargraphenebase.ecdsasig import sign_message
13
- from nectargraphenebase.py23 import py23_bytes
14
13
 
15
14
  from .account import Account
16
15
  from .instance import shared_blockchain_instance
@@ -64,7 +63,7 @@ class Conveyor(object):
64
63
  self.id = 0
65
64
  self.ENCODING = "utf-8"
66
65
  self.TIMEFORMAT = "%Y-%m-%dT%H:%M:%S.%f"
67
- self.K = hashlib.sha256(py23_bytes("steem_jsonrpc_auth", self.ENCODING)).digest()
66
+ self.K = hashlib.sha256(bytes("steem_jsonrpc_auth", self.ENCODING)).digest()
68
67
 
69
68
  def prehash_message(self, timestamp, account, method, params, nonce):
70
69
  """Prepare a hash for the Conveyor API request with SHA256 according
@@ -78,7 +77,7 @@ class Conveyor(object):
78
77
  :param bytes nonce: random 8 bytes
79
78
 
80
79
  """
81
- first = hashlib.sha256(py23_bytes(timestamp + account + method + params, self.ENCODING))
80
+ first = hashlib.sha256(bytes(timestamp + account + method + params, self.ENCODING))
82
81
  return self.K + first.digest() + nonce
83
82
 
84
83
  def _request(self, account, method, params, key):
@@ -91,7 +90,7 @@ class Conveyor(object):
91
90
  :param str key: Steem posting key for signing
92
91
 
93
92
  """
94
- params_bytes = py23_bytes(json.dumps(params), self.ENCODING)
93
+ params_bytes = bytes(json.dumps(params), self.ENCODING)
95
94
  params_enc = base64.b64encode(params_bytes).decode(self.ENCODING)
96
95
  timestamp = datetime.now(timezone.utc).strftime(self.TIMEFORMAT)[:-3] + "Z"
97
96
  nonce_int = random.getrandbits(64)
nectar/exceptions.py CHANGED
@@ -1,7 +1,13 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
 
4
- class WalletExists(Exception):
4
+ class NectarException(Exception):
5
+ """Base exception for all Nectar-related errors"""
6
+
7
+ pass
8
+
9
+
10
+ class WalletExists(NectarException):
5
11
  """A wallet has already been created and requires a password to be
6
12
  unlocked by means of :func:`nectar.wallet.Wallet.unlock`.
7
13
  """
@@ -9,85 +15,85 @@ class WalletExists(Exception):
9
15
  pass
10
16
 
11
17
 
12
- class RPCConnectionRequired(Exception):
18
+ class RPCConnectionRequired(NectarException):
13
19
  """An RPC connection is required"""
14
20
 
15
21
  pass
16
22
 
17
23
 
18
- class InvalidMemoKeyException(Exception):
24
+ class InvalidMemoKeyException(NectarException):
19
25
  """Memo key in message is invalid"""
20
26
 
21
27
  pass
22
28
 
23
29
 
24
- class WrongMemoKey(Exception):
30
+ class WrongMemoKey(NectarException):
25
31
  """The memo provided is not equal the one on the blockchain"""
26
32
 
27
33
  pass
28
34
 
29
35
 
30
- class OfflineHasNoRPCException(Exception):
36
+ class OfflineHasNoRPCException(NectarException):
31
37
  """When in offline mode, we don't have RPC"""
32
38
 
33
39
  pass
34
40
 
35
41
 
36
- class AccountExistsException(Exception):
42
+ class AccountExistsException(NectarException):
37
43
  """The requested account already exists"""
38
44
 
39
45
  pass
40
46
 
41
47
 
42
- class AccountDoesNotExistsException(Exception):
48
+ class AccountDoesNotExistsException(NectarException):
43
49
  """The account does not exist"""
44
50
 
45
51
  pass
46
52
 
47
53
 
48
- class AssetDoesNotExistsException(Exception):
54
+ class AssetDoesNotExistsException(NectarException):
49
55
  """The asset does not exist"""
50
56
 
51
57
  pass
52
58
 
53
59
 
54
- class InvalidAssetException(Exception):
60
+ class InvalidAssetException(NectarException):
55
61
  """An invalid asset has been provided"""
56
62
 
57
63
  pass
58
64
 
59
65
 
60
- class InsufficientAuthorityError(Exception):
66
+ class InsufficientAuthorityError(NectarException):
61
67
  """The transaction requires signature of a higher authority"""
62
68
 
63
69
  pass
64
70
 
65
71
 
66
- class VotingInvalidOnArchivedPost(Exception):
72
+ class VotingInvalidOnArchivedPost(NectarException):
67
73
  """The transaction requires signature of a higher authority"""
68
74
 
69
75
  pass
70
76
 
71
77
 
72
- class MissingKeyError(Exception):
78
+ class MissingKeyError(NectarException):
73
79
  """A required key couldn't be found in the wallet"""
74
80
 
75
81
  pass
76
82
 
77
83
 
78
- class InvalidWifError(Exception):
84
+ class InvalidWifError(NectarException):
79
85
  """The provided private Key has an invalid format"""
80
86
 
81
87
  pass
82
88
 
83
89
 
84
- class BlockDoesNotExistsException(Exception):
90
+ class BlockDoesNotExistsException(NectarException):
85
91
  """The block does not exist"""
86
92
 
87
93
  pass
88
94
 
89
95
 
90
- class NoWalletException(Exception):
96
+ class NoWalletException(NectarException):
91
97
  """No Wallet could be found, please use :func:`nectar.wallet.Wallet.create` to
92
98
  create a new wallet
93
99
  """
@@ -95,55 +101,55 @@ class NoWalletException(Exception):
95
101
  pass
96
102
 
97
103
 
98
- class WitnessDoesNotExistsException(Exception):
104
+ class WitnessDoesNotExistsException(NectarException):
99
105
  """The witness does not exist"""
100
106
 
101
107
  pass
102
108
 
103
109
 
104
- class ContentDoesNotExistsException(Exception):
110
+ class ContentDoesNotExistsException(NectarException):
105
111
  """The content does not exist"""
106
112
 
107
113
  pass
108
114
 
109
115
 
110
- class VoteDoesNotExistsException(Exception):
116
+ class VoteDoesNotExistsException(NectarException):
111
117
  """The vote does not exist"""
112
118
 
113
119
  pass
114
120
 
115
121
 
116
- class WrongMasterPasswordException(Exception):
122
+ class WrongMasterPasswordException(NectarException):
117
123
  """The password provided could not properly unlock the wallet"""
118
124
 
119
125
  pass
120
126
 
121
127
 
122
- class VestingBalanceDoesNotExistsException(Exception):
128
+ class VestingBalanceDoesNotExistsException(NectarException):
123
129
  """Vesting Balance does not exist"""
124
130
 
125
131
  pass
126
132
 
127
133
 
128
- class InvalidMessageSignature(Exception):
134
+ class InvalidMessageSignature(NectarException):
129
135
  """The message signature does not fit the message"""
130
136
 
131
137
  pass
132
138
 
133
139
 
134
- class NoWriteAccess(Exception):
140
+ class NoWriteAccess(NectarException):
135
141
  """Cannot store to sqlite3 database due to missing write access"""
136
142
 
137
143
  pass
138
144
 
139
145
 
140
- class BatchedCallsNotSupported(Exception):
146
+ class BatchedCallsNotSupported(NectarException):
141
147
  """Batch calls do not work"""
142
148
 
143
149
  pass
144
150
 
145
151
 
146
- class BlockWaitTimeExceeded(Exception):
152
+ class BlockWaitTimeExceeded(NectarException):
147
153
  """Wait time for new block exceeded"""
148
154
 
149
155
  pass
nectar/hive.py CHANGED
@@ -6,7 +6,6 @@ from datetime import date, datetime, timezone
6
6
  from nectar.blockchaininstance import BlockChainInstance
7
7
  from nectar.constants import STEEM_100_PERCENT
8
8
  from nectargraphenebase.chains import known_chains
9
- from nectargraphenebase.py23 import string_types
10
9
 
11
10
  from .amount import Amount
12
11
  from .utils import formatToTimeStamp
@@ -124,7 +123,7 @@ class Hive(BlockChainInstance):
124
123
  return known_chains["HIVE"]
125
124
  try:
126
125
  return self.rpc.get_network(props=config)
127
- except:
126
+ except Exception:
128
127
  return known_chains["HIVE"]
129
128
 
130
129
  def rshares_to_token_backed_dollar(
@@ -362,7 +361,7 @@ class Hive(BlockChainInstance):
362
361
  """
363
362
  if isinstance(hbd, Amount):
364
363
  hbd = Amount(hbd, blockchain_instance=self)
365
- elif isinstance(hbd, string_types):
364
+ elif isinstance(hbd, str):
366
365
  hbd = Amount(hbd, blockchain_instance=self)
367
366
  else:
368
367
  hbd = Amount(hbd, self.hbd_symbol, blockchain_instance=self)
@@ -486,7 +485,7 @@ class Hive(BlockChainInstance):
486
485
  """
487
486
  if isinstance(hbd, Amount):
488
487
  hbd = Amount(hbd, blockchain_instance=self)
489
- elif isinstance(hbd, string_types):
488
+ elif isinstance(hbd, str):
490
489
  hbd = Amount(hbd, blockchain_instance=self)
491
490
  else:
492
491
  hbd = Amount(hbd, self.hbd_symbol, blockchain_instance=self)
nectar/hivesigner.py CHANGED
@@ -33,7 +33,7 @@ class HiveSigner(object):
33
33
  from nectar import Steem
34
34
  from nectar.HiveSigner import HiveSigner
35
35
  from nectar.comment import Comment
36
- hs = HiveSigner(client_id="nectar.app")
36
+ hs = HiveSigner(client_id="nectarflower")
37
37
  steem = Steem(HiveSigner=hs)
38
38
  steem.wallet.unlock("supersecret-passphrase")
39
39
  post = Comment("author/permlink", blockchain_instance=steem)
@@ -377,7 +377,7 @@ class HiveSigner(object):
377
377
  try:
378
378
  amount = Amount(value, blockchain_instance=self.blockchain)
379
379
  params[key] = str(amount)
380
- except:
380
+ except Exception:
381
381
  amount = None
382
382
  elif isinstance(value, bool):
383
383
  if value: