Skip to content

Commit 1c0befd

Browse files
author
方佳
committed
Merge branch 'main_merge_251218_001' into 'main'
feat: Optimize token storage See merge request webull/webull-openapi-python-sdk!11
2 parents 63f637a + 6547b21 commit 1c0befd

23 files changed

Lines changed: 226 additions & 16 deletions

‎samples/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.0.6'
1+
__version__ = '1.0.7'

‎samples/account/__init__.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# coding=utf-8

‎samples/account/account_client.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
your_app_secret = "<your_app_secret>"
2525
region_id = "<region_id>" # hk or us
2626
account_id = "<your_account_id>"
27+
# The token_dir parameter can be used to specify the directory for storing the 2FA token. Both absolute and relative paths are supported and this option has the highest priority.
28+
# Alternatively, the storage directory can be configured via an environment variable with the key WEBULL_OPENAPI_TOKEN_DIR, which also supports both absolute and relative paths.
29+
# If neither is specified, the default configuration will be used, and the token will be stored at conf/token.txt under the current working directory.
30+
# token_dir = "<your_token_dir>"
31+
# api_client.set_token_dir(token_dir)
32+
2733
api_client = ApiClient(your_app_key, your_app_secret, region_id)
2834
api_client.add_endpoint(region_id, optional_api_endpoint)
2935

‎samples/assets/__init__.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# coding=utf-8

‎samples/assets/assets_client.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
your_app_secret = "<your_app_secret>"
2525
region_id = "<region_id>" # hk or us
2626
account_id = "<your_account_id>"
27+
# The token_dir parameter can be used to specify the directory for storing the 2FA token. Both absolute and relative paths are supported and this option has the highest priority.
28+
# Alternatively, the storage directory can be configured via an environment variable with the key WEBULL_OPENAPI_TOKEN_DIR, which also supports both absolute and relative paths.
29+
# If neither is specified, the default configuration will be used, and the token will be stored at conf/token.txt under the current working directory.
30+
# token_dir = "<your_token_dir>"
31+
# api_client.set_token_dir(token_dir)
32+
2733
api_client = ApiClient(your_app_key, your_app_secret, region_id)
2834
api_client.add_endpoint(region_id, optional_api_endpoint)
2935

‎samples/data/data_client.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,16 @@
2424
your_app_key = "<your_app_key>"
2525
your_app_secret = "<your_app_secret>"
2626
region_id = "<region_id>"
27+
# The token_dir parameter can be used to specify the directory for storing the 2FA token. Both absolute and relative paths are supported and this option has the highest priority.
28+
# Alternatively, the storage directory can be configured via an environment variable with the key WEBULL_OPENAPI_TOKEN_DIR, which also supports both absolute and relative paths.
29+
# If neither is specified, the default configuration will be used, and the token will be stored at conf/token.txt under the current working directory.
30+
# token_dir = "<your_token_dir>"
31+
# api_client.set_token_dir(token_dir)
32+
2733
api_client = ApiClient(your_app_key, your_app_secret, region_id)
2834
api_client.add_endpoint(region_id, optional_api_endpoint)
2935

36+
3037
if __name__ == '__main__':
3138
data_client = DataClient(api_client)
3239

‎samples/data/data_streaming_client.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
optional_api_endpoint = "</optional_quotes_endpoint>"
2828
optional_quotes_endpoint = "</optional_quotes_endpoint>"
2929
region_id = '<region_id>'
30+
# The token_dir parameter can be used to specify the directory for storing the 2FA token. Both absolute and relative paths are supported and this option has the highest priority.
31+
# Alternatively, the storage directory can be configured via an environment variable with the key WEBULL_OPENAPI_TOKEN_DIR, which also supports both absolute and relative paths.
32+
# If neither is specified, the default configuration will be used, and the token will be stored at conf/token.txt under the current working directory.
33+
# token_dir = "<your_token_dir>"
34+
# data_streaming_client.set_token_dir(token_dir)
3035

3136
session_id = uuid.uuid4().hex
3237
data_streaming_client = DataStreamingClient(your_app_key, your_app_secret, region_id, session_id,

‎samples/data/data_streaming_client_async.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
optional_api_endpoint = "</optional_quotes_endpoint>"
2828
optional_quotes_endpoint = "</optional_quotes_endpoint>"
2929
region_id = '<region_id>'
30+
# The token_dir parameter can be used to specify the directory for storing the 2FA token. Both absolute and relative paths are supported and this option has the highest priority.
31+
# Alternatively, the storage directory can be configured via an environment variable with the key WEBULL_OPENAPI_TOKEN_DIR, which also supports both absolute and relative paths.
32+
# If neither is specified, the default configuration will be used, and the token will be stored at conf/token.txt under the current working directory.
33+
# token_dir = "<your_token_dir>"
34+
# data_streaming_client.set_token_dir(token_dir)
3035

3136
session_id = uuid.uuid4().hex
3237
data_streaming_client = DataStreamingClient(your_app_key, your_app_secret, region_id, session_id,

‎samples/order/__init__.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# coding=utf-8

‎samples/order/order_option_client.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
your_app_secret = "<your_app_secret>"
2222
region_id = "<region_id>" # hk or us
2323
account_id = "<your_account_id>"
24+
# The token_dir parameter can be used to specify the directory for storing the 2FA token. Both absolute and relative paths are supported and this option has the highest priority.
25+
# Alternatively, the storage directory can be configured via an environment variable with the key WEBULL_OPENAPI_TOKEN_DIR, which also supports both absolute and relative paths.
26+
# If neither is specified, the default configuration will be used, and the token will be stored at conf/token.txt under the current working directory.
27+
# token_dir = "<your_token_dir>"
28+
# api_client.set_token_dir(token_dir)
29+
2430
api_client = ApiClient(your_app_key, your_app_secret, region_id)
2531
api_client.add_endpoint(region_id, optional_api_endpoint)
2632

0 commit comments

Comments
 (0)