Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """UJ VALTOZAT: https://pastebin.com/EKMT9R2K"
- azonosito=<kartya szam utolso 8 szamjegye>
- telekod=<kartya szam utolso 3 szamjegye>
- import requests
- import re
- import json
- import datetime
- url_api = 'https://magan.szepkartya.otpportalok.hu/ajax/egyenleglekerdezes/'
- url_html = 'https://magan.szepkartya.otpportalok.hu/fooldal/'
- def to_int(e):
- return 0 if e.strip() == '' else int(e.strip().replace('+', ''))
- """GET TOKENS"""
- r = requests.get(url_html)
- match = re.search(r'ajax_token = \'([a-z0-9]{64})\'', r.text)
- token = match.group(1)
- phpsess = r.cookies['PHPSESSID']
- """GET BALLANCE"""
- body = f's_azonosito_k={azonosito}&s_telekod_k={telekod}&ajax_token={token}&s_captcha='
- cookies = dict(PHPSESSID=phpsess)
- headers = {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}
- resp_api = requests.post(url_api, headers=headers, data=body, cookies=cookies)
- resp_json = json.loads(resp_api.text)
- if resp_json[0] == 'RC':
- print('ERROR: Captcha protection kicked in (too many requests)')
- else:
- vendeglatas = to_int(resp_json[1]['szamla_osszeg7'])
- szabadido = to_int(resp_json[1]['szamla_osszeg8'])
- szallas = to_int(resp_json[1]['szamla_osszeg9'])
- print('-'*80)
- print(f"vendeglatas: {vendeglatas:>9,}")
- print(f" szabadido: {szabadido:>9,}")
- print(f" szallas: {szallas:>9,}")
- print('-'*80)
- f=open("otp_szep_egyenleg.txt", 'a')
- f.write('-'*80+'\n')
- f.write(datetime.datetime.now().strftime("%Y.%m.%d %H:%M:%S")+'\n')
- f.write(f"vendeglatas: {vendeglatas:>9,}\n")
- f.write(f"szabadido: {szabadido:>9,}\n")
- f.write(f"szallas: {szallas:>9,}\n")
- f.close()
- input('Press ENTER ')
Add Comment
Please, Sign In to add comment