Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions koios_python/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def get_pool_delegators(self, pool_bech32, content_range="0-999"):


@Exception_Handler
def get_pool_delegators_history(self, pool_bech32, epoch_no=None):
def get_pool_delegators_history(self, pool_bech32, epoch_no=None, content_range="0-999"):
"""
Return information about active delegators (incl. history) for a given pool and epoch number \
(all epochs if not specified).
Expand All @@ -82,11 +82,12 @@ def get_pool_delegators_history(self, pool_bech32, epoch_no=None):
:rtype: list.
"""
timeout = get_timeout()
custom_headers = {"Range": str(content_range)}
if epoch_no is None:
info = requests.get(self.POOL_DELEGATORS_HISTORY_URL + pool_bech32, timeout=timeout)
info = requests.get(self.POOL_DELEGATORS_HISTORY_URL + pool_bech32, headers=custom_headers, timeout=timeout)
info = json.loads(info.content)
else:
info = requests.get(f"{self.POOL_DELEGATORS_HISTORY_URL}{pool_bech32}&_epoch={epoch_no}", timeout=timeout)
info = requests.get(f"{self.POOL_DELEGATORS_HISTORY_URL}{pool_bech32}&_epoch_no={epoch_no}", headers=custom_headers, timeout=timeout)
info = json.loads(info.content)
return info

Expand Down
19 changes: 10 additions & 9 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,24 @@
kp = koios_python.URLs() # We need to create an instance of the class URLs
#print(kp.get_tip())

print('------------------------------------------------------------------------------------------------------------------------------------------------------')
# print('------------------------------------------------------------------------------------------------------------------------------------------------------')

#print(kp.get_genesis())
# #print(kp.get_genesis())

print('------------------------------------------------------------------------------------------------------------------------------------------------------')
# print('------------------------------------------------------------------------------------------------------------------------------------------------------')

#print(kp.get_totals())
# pprint.pp(kp.get_pool_delegators_history("pool1hrv8gtrm0dgjg6zyss5uwa4nkruzfnh5vrdkr2sayj7x2nw6mjc", 391))

print('------------------------------------------------------------------------------------------------------------------------------------------------------')
# print('------------------------------------------------------------------------------------------------------------------------------------------------------')

check_big_account = kp.get_account_addresses(["stake1uxqh9rn76n8nynsnyvf4ulndjv0srcc8jtvumut3989cqmgjt49h6"])
pprint.pp(check_big_account)
# check_big_account = kp.get_account_addresses(["stake1uxqh9rn76n8nynsnyvf4ulndjv0srcc8jtvumut3989cqmgjt49h6"])
# pprint.pp(check_big_account)

print('------------------------------------------------------------------------------------------------------------------------------------------------------')
# print('------------------------------------------------------------------------------------------------------------------------------------------------------')

check_big_account = kp.get_account_addresses(["stake1uxqh9rn76n8nynsnyvf4ulndjv0srcc8jtvumut3989cqmgjt49h6"])
pprint.pp(check_big_account)
# check_big_account = kp.get_account_addresses(["stake1uxqh9rn76n8nynsnyvf4ulndjv0srcc8jtvumut3989cqmgjt49h6"])
# pprint.pp(check_big_account)


############################################################
Expand Down