python da request ile bir bot yazmaya çalışıyorum ama cevap olarak 400 alıyorum yani bad request. Normalde bot tradingview'e giriş yapıp alarm oluşturuyor ama sebebini çözemediğim bir şekilde alarmları oluştururken hata alıyorum.
Yardımcı olanlara şimdiden çok teşekkür ederim.
Kod:

import requests
url = "https://pine-facade.tradingview.com/pine-facade/gen_alert/?user_name=*******"
headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36',
'origin': 'https://tr.tradingview.com'
}
data = {
'alert_info': '{"version":21,"condition":{"id":"cross","fireInfo":{"frequency":"on_first_fire"},"mainSeries":{"id":"-273720050"},"alertSeries":
{"id":"-273720050"},"band":{"id":"4iHylo"}},"statesForAlert":{"-273720050":{"id":"-273720050","uniqueId":"-273720050","type":"MainSeries","proSymbol":"BIST:XU100",
"actualSymbol":"BIST_DLY:XU100","symbolString":"={\"symbol\":\"BIST_DLY:XU100\",\"adjustment\":\"splits\"}","interval":"1D","style":1,"styleInputs":{},
"extendedHours":false,"dividendsAdjustment":false,"isSpread":false,"formatter":{"type":"price","state":{"fractional":false,"fractionalLength":2,"minMove":1,
"minMove2":0,"priceScale":100}}},"4iHylo":{"id":"4iHylo","uniqueId":"4iHylo","type":"Value","value":"1441.3"}},"message":"BU BİR DENEMEDİR"}'
}
login_header = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36',
'origin': 'https://tr.tradingview.com',
'referer': 'https://tr.tradingview.com/chart/UBleIH5q/'
}
login_url = "https://tr.tradingview.com/accounts/signin/"
login_data = {
'username': '****',
'password': '*****',
'remember': 'off'
}
with requests.Session() as s:
y = s.post(login_url, data=login_data, headers=login_header)
print(y)
response = s.post(url, data=data, headers=headers)
print(response)
