Skip to content

Commit 08783a5

Browse files
authored
Merge pull request #22 from Safeheron/dev
Added Deactivate API Key interfaces
2 parents ee15d71 + ef4aa24 commit 08783a5

4 files changed

Lines changed: 87 additions & 23 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Manually Publish Python Package to PyPI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Python for Safeheron API'
10+
required: true
11+
default: '0.0.1'
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
build-and-publish:
18+
name: Build and Publish to PyPI
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: '3.x'
31+
32+
- name: Install build dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install build setuptools wheel
36+
37+
- name: Build package
38+
run: python -m build --sdist --wheel --outdir dist/ .
39+
40+
- name: Verify created files
41+
run: ls -l dist/
42+
43+
- name: Publish distribution to PyPI
44+
uses: pypa/gh-action-pypi-publish@release/v1
45+
with:
46+
user: __token__
47+
password: ${{ secrets.PYPI_API_TOKEN }}

requirements.txt

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
aiohttp==3.9.2
2-
aiosignal==1.3.1
1+
aiohttp==3.12.14
2+
aiosignal==1.4.0
33
allure-pytest==2.13.1
44
allure-python-commons==2.13.1
55
async-timeout==4.0.2
@@ -9,16 +9,16 @@ bitarray==2.8.1
99
blinker==1.8.2
1010
Brotli==1.0.9
1111
cachelib==0.9.0
12-
certifi==2024.2.2
13-
cffi==1.15.0
12+
certifi==2024.7.4
13+
cffi==1.17.1
1414
charset-normalizer==3.3.2
1515
click==8.1.7
1616
ConfigArgParse==1.5.3
17-
cryptography==39.0.1
17+
cryptography==43.0.1
1818
cycler==0.11.0
1919
cytoolz==0.12.2
2020
docutils==0.21.2
21-
eth-abi==4.2.0
21+
eth-abi==5.0.1
2222
eth-account==0.9.0
2323
eth-hash==0.5.2
2424
eth-keyfile==0.6.1
@@ -29,11 +29,11 @@ eth-utils==2.2.0
2929
exceptiongroup==1.1.1
3030
Flask-BasicAuth==0.2.0
3131
Flask-Caching==2.3.0
32-
Flask-Cors==4.0.2
33-
frozenlist==1.3.3
34-
gevent==23.9.0
32+
Flask-Cors==6.0.0
33+
frozenlist==1.7.0
34+
gevent==25.5.1
3535
geventhttpclient==1.5.3
36-
greenlet==2.0.2
36+
greenlet==3.2.2
3737
hexbytes==0.3.1
3838
idna==3.7
3939
importlib_metadata==8.3.0
@@ -42,7 +42,7 @@ itsdangerous==2.2.0
4242
jaraco.classes==3.4.0
4343
jaraco.context==6.0.1
4444
jaraco.functools==4.0.2
45-
Jinja2==3.0.3
45+
Jinja2==3.1.6
4646
jsonpath==0.82
4747
jsonschema==4.19.0
4848
jsonschema-specifications==2023.7.1
@@ -53,7 +53,7 @@ MarkupSafe==2.1.5
5353
mdurl==0.1.2
5454
more-itertools==10.4.0
5555
msgpack==1.0.3
56-
multidict==6.0.4
56+
multidict==6.6.4
5757
Naked==0.1.31
5858
nh3==0.2.18
5959
packaging==23.0
@@ -66,44 +66,43 @@ py==1.11.0
6666
pycparser==2.21
6767
pycryptodome==3.19.1
6868
pycryptodomex==3.19.1
69-
pygame==2.5.2
69+
pygame==2.6.1
7070
Pygments==2.18.0
7171
PyMySQL==1.1.1
7272
pyparsing==3.0.7
7373
PySocks==1.7.1
7474
pytest==7.2.2
7575
pytest-html==3.2.0
7676
pytest-metadata==2.0.4
77-
pyunormalize==15.0.0
77+
pyunormalize==16.0.0
7878
PyYAML==6.0.1
79-
pyzmq==22.3.0
79+
pyzmq==27.0.2
8080
readme_renderer==44.0
8181
referencing==0.30.2
8282
regex==2023.8.8
83-
requests==2.32.3
83+
requests==2.32.4
8484
requests-toolbelt==1.0.0
8585
rfc3986==2.0.0
8686
rich==13.7.1
8787
rlp==3.0.0
8888
roundrobin==0.0.2
89-
rpds-py==0.10.2
90-
safeheron_api_sdk_python==1.1.2
89+
rpds-py==0.27.0
9190
shellescape==3.8.1
9291
six==1.16.0
9392
sounddevice==0.4.6
9493
tomli==2.0.1
9594
toolz==0.12.0
96-
tqdm==4.66.1
95+
tqdm==4.66.3
9796
twine==5.1.1
9897
typing_extensions==4.1.1
99-
urllib3==2.2.2
98+
urllib3==2.5.0
10099
web3==6.9.0
101100
websocket==0.2.1
102101
websocket-client==1.5.1
103102
websockets==11.0.3
104-
Werkzeug==3.0.3
103+
Werkzeug==3.0.6
105104
xmltodict==0.13.0
106-
yarl==1.8.2
105+
yarl==1.20.1
107106
zipp==3.20.0
108107
zope.event==4.6
109108
zope.interface==6.0
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from safeheron_api_sdk_python.client import *
2+
3+
4+
class ApiKeyManagementApi:
5+
6+
def __init__(self, config):
7+
self.api_client = Client(config)
8+
9+
#
10+
# Deactivate API Key
11+
# 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:
12+
#
13+
# The API Key is no longer in use and should be deactivated promptly to avoid risk;
14+
# The API Key's private key is suspected of being leaked, and it needs to be deactivated immediately to ensure fund security;
15+
# You receive an Illegal IP Request Event via Webhook and, after evaluation, need to deactivate the API Key (Event Type: ILLEGAL_IP_REQUEST);
16+
# 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.
17+
def disable_apikey(self):
18+
return self.api_client.send_request(None, '/v1/apikey/disable')

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
with open("README.rst", "r") as f:
44
long_description = f.read()
55
setup(name='safeheron_api_sdk_python',
6-
version='1.1.17',
6+
version='1.1.18',
77
description='Python for Safeheron API',
88
long_description=long_description,
99
author='safeheron',

0 commit comments

Comments
 (0)