RAPTOR v18.4: Исправлена отчетность, активированы выходные
This commit is contained in:
19
test_api.py
Normal file
19
test_api.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import os, requests
|
||||
from dotenv import load_dotenv
|
||||
load_dotenv("tok.env")
|
||||
|
||||
TOKEN = os.getenv("TINKOFF_TOKEN")
|
||||
UID = "a78b8349-a1dc-447d-9277-1d75826d089a"
|
||||
# ВНИМАНИЕ: исправлен URL (добавлен / перед tinkoff)
|
||||
URL = "https://invest-public-api.tinkoff.ru/rest/tinkoff.public.invest.api.marketdata.v1.MarketDataService/GetLastPrices"
|
||||
|
||||
headers = {"Authorization": f"Bearer {TOKEN}", "Content-Type": "application/json"}
|
||||
# ВАЖНО: убедитесь, что в json передается именно "instrumentId": [UID]
|
||||
r = requests.post(URL, json={"instrumentId": [UID]}, headers=headers)
|
||||
|
||||
print(f"Статус: {r.status_code}")
|
||||
if r.status_code == 200:
|
||||
print("✅ Успех! Цена получена.")
|
||||
print(f"Данные: {r.json()}")
|
||||
else:
|
||||
print(f"❌ Ошибка: {r.text}")
|
||||
Reference in New Issue
Block a user