RAPTOR v18.4: Исправлена отчетность, активированы выходные
This commit is contained in:
23
invest-python-master/examples/logger.py
Normal file
23
invest-python-master/examples/logger.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import logging
|
||||
import os
|
||||
|
||||
from t_tech.invest import Client, RequestError
|
||||
|
||||
TOKEN = os.environ["INVEST_TOKEN"]
|
||||
|
||||
logging.basicConfig(format="%(asctime)s %(levelname)s:%(message)s", level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def main():
|
||||
with Client(TOKEN) as client:
|
||||
_ = client.users.get_accounts().accounts
|
||||
try:
|
||||
client.users.get_margin_attributes(account_id="123")
|
||||
except RequestError as err:
|
||||
tracking_id = err.metadata.tracking_id if err.metadata else ""
|
||||
logger.error("Error tracking_id=%s code=%s", tracking_id, str(err.code))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user