Skip to content

Commit

Permalink
兼容高版本cryptography库
Browse files Browse the repository at this point in the history
  • Loading branch information
minibear2021 committed Feb 26, 2024
1 parent 1156b4c commit 29936c9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
6 changes: 6 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [1.2.45] - 2024-02-25

### Fixed

- 兼容高版本cryptography库

## [1.2.44] - 2024-02-05

### Fixed
Expand Down
Binary file modified docs/qq.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="wechatpayv3",
version="1.2.44",
version="1.2.45",
author="minibear",
description="微信支付 API v3 Python SDK(python sdk for wechatpay v3)",
long_description=long_description,
Expand Down
11 changes: 8 additions & 3 deletions wechatpayv3/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,14 @@ def _update_certificates(self):
certificate = load_certificate(cert_str)
if not certificate:
continue
now = datetime.now(timezone.utc)
if now < certificate.not_valid_before_utc or now > certificate.not_valid_after_utc:
continue
if (int(cryptography_version.split(".")[0]) < 42):
now = datetime.utcnow()
if now < certificate.not_valid_before or now > certificate.not_valid_after:
continue
else:
now = datetime.now(timezone.utc)
if now < certificate.not_valid_before_utc or now > certificate.not_valid_after_utc:
continue
self._certificates.append(certificate)
if not self._cert_dir:
continue
Expand Down

0 comments on commit 29936c9

Please sign in to comment.