From 35efdcf80a18c9d1724b2fcdd94a3c261a7fac11 Mon Sep 17 00:00:00 2001 From: absorprofess Date: Thu, 21 Aug 2025 19:07:45 +0800 Subject: [PATCH 1/3] Added Deactivate API Key interfaces --- requirements.txt | 13 ++++++------- .../api/api_key_management_api.py | 18 ++++++++++++++++++ setup.py | 2 +- 3 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 safeheron_api_sdk_python/api/api_key_management_api.py diff --git a/requirements.txt b/requirements.txt index 72b28bb..00a0e65 100644 --- a/requirements.txt +++ b/requirements.txt @@ -31,9 +31,9 @@ Flask-BasicAuth==0.2.0 Flask-Caching==2.3.0 Flask-Cors==4.0.2 frozenlist==1.3.3 -gevent==23.9.0 +gevent==25.5.1 geventhttpclient==1.5.3 -greenlet==2.0.2 +greenlet==3.2.2 hexbytes==0.3.1 idna==3.7 importlib_metadata==8.3.0 @@ -66,7 +66,7 @@ py==1.11.0 pycparser==2.21 pycryptodome==3.19.1 pycryptodomex==3.19.1 -pygame==2.5.2 +pygame==2.6.1 Pygments==2.18.0 PyMySQL==1.1.1 pyparsing==3.0.7 @@ -74,9 +74,9 @@ PySocks==1.7.1 pytest==7.2.2 pytest-html==3.2.0 pytest-metadata==2.0.4 -pyunormalize==15.0.0 +pyunormalize==16.0.0 PyYAML==6.0.1 -pyzmq==22.3.0 +pyzmq==27.0.2 readme_renderer==44.0 referencing==0.30.2 regex==2023.8.8 @@ -86,8 +86,7 @@ rfc3986==2.0.0 rich==13.7.1 rlp==3.0.0 roundrobin==0.0.2 -rpds-py==0.10.2 -safeheron_api_sdk_python==1.1.2 +rpds-py==0.27.0 shellescape==3.8.1 six==1.16.0 sounddevice==0.4.6 diff --git a/safeheron_api_sdk_python/api/api_key_management_api.py b/safeheron_api_sdk_python/api/api_key_management_api.py new file mode 100644 index 0000000..14cbb54 --- /dev/null +++ b/safeheron_api_sdk_python/api/api_key_management_api.py @@ -0,0 +1,18 @@ +from safeheron_api_sdk_python.client import * + + +class ApiKeyManagementApi: + + def __init__(self, config): + self.api_client = Client(config) + + # + # Deactivate API Key + # This interface is used to apply to deactivate the currently used API Key (this can also be done in the Web Console). After the application is submitted, it will only take effect once a team administrator approves it in the Safeheron App. Once an API Key is deactivated, it will no longer be able to access any interfaces. For example, you can apply to deactivate an API Key in the following situations to protect your assets: + # + # The API Key is no longer in use and should be deactivated promptly to avoid risk; + # The API Key's private key is suspected of being leaked, and it needs to be deactivated immediately to ensure fund security; + # You receive an Illegal IP Request Event via Webhook and, after evaluation, need to deactivate the API Key (Event Type: ILLEGAL_IP_REQUEST); + # To resume using it, you can submit an activation request through the Web Console. This will also require approval from a team administrator before the API Key can be reactivated. + def disable_apikey(self): + return self.api_client.send_request(None, '/v1/apikey/disable') diff --git a/setup.py b/setup.py index f94767f..07b7318 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ with open("README.rst", "r") as f: long_description = f.read() setup(name='safeheron_api_sdk_python', - version='1.1.17', + version='1.1.18', description='Python for Safeheron API', long_description=long_description, author='safeheron', From e4fd0590c98915c0ce7a6fe1619c677f92cfbd13 Mon Sep 17 00:00:00 2001 From: absorprofess Date: Thu, 21 Aug 2025 19:32:16 +0800 Subject: [PATCH 2/3] add pypi-publish.yaml --- .github/workflows/pypi-publish.yaml | 47 +++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/pypi-publish.yaml diff --git a/.github/workflows/pypi-publish.yaml b/.github/workflows/pypi-publish.yaml new file mode 100644 index 0000000..065b285 --- /dev/null +++ b/.github/workflows/pypi-publish.yaml @@ -0,0 +1,47 @@ +name: Manually Publish Python Package to PyPI +on: + push: + branches: + - main + workflow_dispatch: + inputs: + version: + description: 'Python for Safeheron API' + required: true + default: '0.0.1' + +permissions: + contents: read + +jobs: + build-and-publish: + name: Build and Publish to PyPI + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Install build dependencies + run: | + python -m pip install --upgrade pip + pip install build setuptools wheel + + - name: Build package + run: python -m build --sdist --wheel --outdir dist/ . + + - name: Verify created files + run: ls -l dist/ + + - name: Publish distribution to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} \ No newline at end of file From ef4aa2434b93d656a8d93cac52f5219715a4632d Mon Sep 17 00:00:00 2001 From: absorprofess Date: Fri, 22 Aug 2025 14:33:36 +0800 Subject: [PATCH 3/3] dependence security updates --- requirements.txt | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/requirements.txt b/requirements.txt index 00a0e65..279a3ee 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -aiohttp==3.9.2 -aiosignal==1.3.1 +aiohttp==3.12.14 +aiosignal==1.4.0 allure-pytest==2.13.1 allure-python-commons==2.13.1 async-timeout==4.0.2 @@ -9,16 +9,16 @@ bitarray==2.8.1 blinker==1.8.2 Brotli==1.0.9 cachelib==0.9.0 -certifi==2024.2.2 -cffi==1.15.0 +certifi==2024.7.4 +cffi==1.17.1 charset-normalizer==3.3.2 click==8.1.7 ConfigArgParse==1.5.3 -cryptography==39.0.1 +cryptography==43.0.1 cycler==0.11.0 cytoolz==0.12.2 docutils==0.21.2 -eth-abi==4.2.0 +eth-abi==5.0.1 eth-account==0.9.0 eth-hash==0.5.2 eth-keyfile==0.6.1 @@ -29,8 +29,8 @@ eth-utils==2.2.0 exceptiongroup==1.1.1 Flask-BasicAuth==0.2.0 Flask-Caching==2.3.0 -Flask-Cors==4.0.2 -frozenlist==1.3.3 +Flask-Cors==6.0.0 +frozenlist==1.7.0 gevent==25.5.1 geventhttpclient==1.5.3 greenlet==3.2.2 @@ -42,7 +42,7 @@ itsdangerous==2.2.0 jaraco.classes==3.4.0 jaraco.context==6.0.1 jaraco.functools==4.0.2 -Jinja2==3.0.3 +Jinja2==3.1.6 jsonpath==0.82 jsonschema==4.19.0 jsonschema-specifications==2023.7.1 @@ -53,7 +53,7 @@ MarkupSafe==2.1.5 mdurl==0.1.2 more-itertools==10.4.0 msgpack==1.0.3 -multidict==6.0.4 +multidict==6.6.4 Naked==0.1.31 nh3==0.2.18 packaging==23.0 @@ -80,7 +80,7 @@ pyzmq==27.0.2 readme_renderer==44.0 referencing==0.30.2 regex==2023.8.8 -requests==2.32.3 +requests==2.32.4 requests-toolbelt==1.0.0 rfc3986==2.0.0 rich==13.7.1 @@ -92,17 +92,17 @@ six==1.16.0 sounddevice==0.4.6 tomli==2.0.1 toolz==0.12.0 -tqdm==4.66.1 +tqdm==4.66.3 twine==5.1.1 typing_extensions==4.1.1 -urllib3==2.2.2 +urllib3==2.5.0 web3==6.9.0 websocket==0.2.1 websocket-client==1.5.1 websockets==11.0.3 -Werkzeug==3.0.3 +Werkzeug==3.0.6 xmltodict==0.13.0 -yarl==1.8.2 +yarl==1.20.1 zipp==3.20.0 zope.event==4.6 zope.interface==6.0