R
R
rus_prog2020-07-18 22:18:44
Python
rus_prog, 2020-07-18 22:18:44

How to move on the site in the parser, while remaining logged in?

Hello.
It is necessary to parse the payment history from the site https://global24.ua .
I pass the authorization process successfully, but then I can’t go to the payment history or profile page.

from bs4 import BeautifulSoup as bs
import requests
import ast

session = requests.Session()

payload = {
  'loginType': "text",
  'login': "LOGIN",
  'password':"PASSWORD"
}

head_post = {
  'user-agent': 'Mozilla/5.0 (Windows NT 10.0; ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36',
  'x-gm-print':' 68867ecb796a743efe1fff8f3df344f0',
}

session.headers = head_post

post = session.post('https://art.global24.ua/login', json=payload)

soup = bs(post.content, 'html.parser')

text = soup.text
dct_post = ast.literal_eval(text)
keytoken = dct_post['keytoken']

then it should be like this
head_get = {
  'user-agent': 'Mozilla/5.0 (Windows NT 10.0; ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36',
  'x-gm-print':'68867ecb796a743efe1fff8f3df344f0',
  'authorization': keytoken
}

session.headers = head_get

profile = session.get('https://art.global24.ua/profile')

prof = bs(profile.content, 'html.parser')

print(profile)
print(prof.text)

but even though print(profile) gives out Respons 200 as it should, but print(prof.text) gives out a strange dictionary with mail, although it seems like the site page should be.
Please help point out my mistake.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question