Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
silkaj
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
python
silkaj
Commits
99664f3b
Commit
99664f3b
authored
3 years ago
by
matograine
Browse files
Options
Downloads
Patches
Plain Diff
[mod]
#344
use pendulum in silkaj.wot
parent
2bf441ba
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
silkaj/wot.py
+9
-7
9 additions, 7 deletions
silkaj/wot.py
with
9 additions
and
7 deletions
silkaj/wot.py
+
9
−
7
View file @
99664f3b
...
@@ -16,6 +16,7 @@ along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
...
@@ -16,6 +16,7 @@ along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
"""
"""
import
click
import
click
import
pendulum
from
time
import
time
from
time
import
time
from
tabulate
import
tabulate
from
tabulate
import
tabulate
from
collections
import
OrderedDict
from
collections
import
OrderedDict
...
@@ -26,9 +27,9 @@ from duniterpy.api.errors import DuniterError
...
@@ -26,9 +27,9 @@ from duniterpy.api.errors import DuniterError
from
silkaj.network_tools
import
ClientInstance
from
silkaj.network_tools
import
ClientInstance
from
silkaj.crypto_tools
import
is_pubkey_and_check
from
silkaj.crypto_tools
import
is_pubkey_and_check
from
silkaj.tools
import
message_exit
,
coroutine
from
silkaj.tools
import
message_exit
,
coroutine
from
silkaj.tui
import
convert_time
,
display_pubkey_and_checksum
from
silkaj.tui
import
display_pubkey_and_checksum
from
silkaj.blockchain_tools
import
BlockchainParams
from
silkaj.blockchain_tools
import
BlockchainParams
from
silkaj.constants
import
ASYNC_SLEEP
from
silkaj.constants
import
ASYNC_SLEEP
,
DATE
def
get_sent_certifications
(
signed
,
time_first_block
,
params
):
def
get_sent_certifications
(
signed
,
time_first_block
,
params
):
...
@@ -132,25 +133,26 @@ async def membership_status(certifications, pubkey, req):
...
@@ -132,25 +133,26 @@ async def membership_status(certifications, pubkey, req):
"
revoked:
"
,
"
revoked:
"
,
req
[
"
revoked
"
],
req
[
"
revoked
"
],
"
\n
revoked on:
"
,
"
\n
revoked on:
"
,
convert_time
(
req
[
"
revoked_on
"
]
,
"
date
"
)
+
"
\n
"
,
pendulum
.
from_timestamp
(
req
[
"
revoked_on
"
]
).
format
(
DATE
)
+
"
\n
"
,
)
)
if
not
member
and
req
[
"
wasMember
"
]:
if
not
member
and
req
[
"
wasMember
"
]:
print
(
"
expired:
"
,
req
[
"
expired
"
],
"
\n
wasMember:
"
,
req
[
"
wasMember
"
])
print
(
"
expired:
"
,
req
[
"
expired
"
],
"
\n
wasMember:
"
,
req
[
"
wasMember
"
])
elif
member
:
elif
member
:
expir_ts
=
time
()
+
req
[
"
membershipExpiresIn
"
]
print
(
print
(
"
Membership document expiration:
"
"
Membership document expiration:
"
+
convert_time
(
time
()
+
req
[
"
membershipExpiresIn
"
],
"
date
"
)
+
pendulum
.
from_timestamp
(
expir_ts
).
format
(
DATE
)
)
)
print
(
"
Sentry:
"
,
req
[
"
isSentry
"
])
print
(
"
Sentry:
"
,
req
[
"
isSentry
"
])
print
(
"
outdistanced:
"
,
req
[
"
outdistanced
"
])
print
(
"
outdistanced:
"
,
req
[
"
outdistanced
"
])
def
expiration_date_from_block_id
(
block_id
,
time_first_block
,
params
):
def
expiration_date_from_block_id
(
block_id
,
time_first_block
,
params
):
return
convert_time
(
expir_timestamp
=
(
date_approximation
(
block_id
,
time_first_block
,
params
[
"
avgGenTime
"
])
date_approximation
(
block_id
,
time_first_block
,
params
[
"
avgGenTime
"
])
+
params
[
"
sigValidity
"
],
+
params
[
"
sigValidity
"
]
"
date
"
,
)
)
return
pendulum
.
from_timestamp
(
expir_timestamp
).
format
(
DATE
)
def
date_approximation
(
block_id
,
time_first_block
,
avgentime
):
def
date_approximation
(
block_id
,
time_first_block
,
avgentime
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment