import requests
from bs4 import BeautifulSoup
payload = {'csrfmiddlewaretoken':'6H4ZKPzNbRpguqRqcu2LKDUeT06CwtwP7i9yZye2ubJqrCOE0jLsuj0zYfMKtvX4','market': 'FOREX','fields': '3' , 'instruments': '"USDKZT_TOD"'}
page = requests.post('https://kase.kz/ru/trades/view/', data = payload)
print(page.status_code)
import requests
import re
url = 'https://kase.kz/ru/trades/'
r = requests.get(url)
cookie_header = r.headers['Set-Cookie']
cookie = re.search('csrftoken=([\s\S]+?);', cookie_header).group(1)
print cookie
cookies = {
'csrftoken': cookie,
'TRADE_USER_SETTINGS_FOREX': '"{\"fields\": [3]\054 \"instruments\": [\"USDKZT_TOD\"]}"',
}
data = {
'csrfmiddlewaretoken': cookie,
'market': 'FOREX',
'instrument': 'USDKZT_TOD',
'field': '3',
}
r = requests.post('https://kase.kz/ru/trades/view/', cookies=cookies, data=data)
print r.status_code
print r.text
import requests
from bs4 import BeautifulSoup
headers = {
'Upgrade-Insecure-Requests': '1',
'Content-Type': 'application/x-www-form-urlencoded'
}
cookies = {
'csrftoken': 'pjxuo6wCuMcSyqKN7U5P3GafthpzBJs4qUC3DPbRN6w2vCH1VJOwNmgAyw5HyLTj',
'TRADE_USER_SETTINGS_FOREX': '"{\"fields\": [3]\054 \"instruments\": [\"USDKZT_TOD\"]}"',
}
data = {
'csrfmiddlewaretoken': 'ICIZdcQ4t80pwinw6DjCrTeJA6b70093JdNysVvjMskztukKUs2jbzk4FlRfX2Ai',
'market': 'FOREX',
'instrument': 'USDKZT_TOD',
'field': '3',
}
r = requests.post('https://kase.kz/ru/trades/view/', headers=headers, cookies=cookies, data=data)
print(r.status_code)