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
8c6851fd
Commit
8c6851fd
authored
3 years ago
by
matograine
Browse files
Options
Downloads
Patches
Plain Diff
[mod]
#344
use pendulum in silkaj.cert
parent
57f695e5
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/cert.py
+11
-5
11 additions, 5 deletions
silkaj/cert.py
with
11 additions
and
5 deletions
silkaj/cert.py
+
11
−
5
View file @
8c6851fd
...
...
@@ -17,6 +17,7 @@ along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
import
sys
import
click
import
pendulum
from
time
import
time
from
tabulate
import
tabulate
from
duniterpy.api
import
bma
...
...
@@ -28,7 +29,7 @@ from silkaj.network_tools import ClientInstance
from
silkaj.blockchain_tools
import
BlockchainParams
,
HeadBlock
from
silkaj.license
import
license_approval
from
silkaj
import
wot
,
tui
from
silkaj.constants
import
SUCCESS_EXIT_STATUS
from
silkaj.constants
import
SUCCESS_EXIT_STATUS
,
DATE
,
ALL
from
silkaj.crypto_tools
import
is_pubkey_and_check
...
...
@@ -108,7 +109,9 @@ async def pre_checks(client, issuer_pubkey, pubkey_to_certify):
# ĞT: 0<–>4.8m - 4.8m + 12.5d
renewable
=
cert
[
"
expiresIn
"
]
-
params
[
"
sigValidity
"
]
+
params
[
"
sigReplay
"
]
if
renewable
>
0
:
renewable_date
=
tui
.
convert_time
(
time
()
+
renewable
,
"
date
"
)
renewable_date
=
pendulum
.
from_timestamp
(
time
()
+
renewable
).
format
(
DATE
)
message_exit
(
"
Certification renewable the
"
+
renewable_date
)
# Check if the certification is already in the pending certifications
...
...
@@ -128,7 +131,10 @@ async def certification_confirmation(
block_uid_idty
=
block_uid
(
idty_timestamp
)
block
=
await
client
(
bma
.
blockchain
.
block
,
block_uid_idty
.
number
)
block_uid_date
=
(
"
: #
"
+
idty_timestamp
[:
15
]
+
"
…
"
+
tui
.
convert_time
(
block
[
"
time
"
],
"
all
"
)
"
: #
"
+
idty_timestamp
[:
15
]
+
"
…
"
+
pendulum
.
from_timestamp
(
block
[
"
time
"
]).
format
(
ALL
)
)
cert
.
append
([
"
ID
"
,
issuer
[
"
uid
"
],
"
–>
"
,
idty_to_certify
[
"
uid
"
]
+
block_uid_date
])
cert
.
append
(
...
...
@@ -140,8 +146,8 @@ async def certification_confirmation(
]
)
params
=
await
BlockchainParams
().
params
cert_begins
=
tui
.
convert_time
(
time
(),
"
date
"
)
cert_ends
=
tui
.
convert_time
(
time
()
+
params
[
"
sigValidity
"
]
,
"
date
"
)
cert_begins
=
pendulum
.
from_timestamp
(
time
()).
format
(
DATE
)
cert_ends
=
pendulum
.
from_timestamp
(
time
()
+
params
[
"
sigValidity
"
]
).
format
(
DATE
)
cert
.
append
([
"
Valid
"
,
cert_begins
,
"
—>
"
,
cert_ends
])
click
.
echo
(
tabulate
(
cert
,
tablefmt
=
"
fancy_grid
"
))
if
not
ctx
.
obj
[
"
DISPLAY_DOCUMENT
"
]:
...
...
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