Skip to content
Snippets Groups Projects
Commit d4332e04 authored by Fabian Schuh's avatar Fabian Schuh
Browse files

[block] Block Header for easier access to time etc.

parent 1c2b842d
No related branches found
No related tags found
No related merge requests found
...@@ -39,3 +39,19 @@ class Block(BlockchainObject): ...@@ -39,3 +39,19 @@ class Block(BlockchainObject):
""" Return a datatime instance for the timestamp of this block """ Return a datatime instance for the timestamp of this block
""" """
return parse_time(self['timestamp']) return parse_time(self['timestamp'])
class BlockHeader(BlockchainObject):
def refresh(self):
""" Even though blocks never change, you freshly obtain its contents
from an API with this method
"""
block = self.bitshares.rpc.get_block_header(self.identifier)
if not block:
raise BlockDoesNotExistsException
super(BlockHeader, self).__init__(block)
def time(self):
""" Return a datatime instance for the timestamp of this block
"""
return parse_time(self['timestamp'])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment