首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Powerschool登录表单数据

Powerschool登录表单数据
EN

Stack Overflow用户
提问于 2017-10-23 11:06:01
回答 1查看 202关注 0票数 1

我正试着登录PowerSchool查看我的成绩。每当我运行代码时,它给我的是登录页面的HTML代码,而不是安全页面的HTML代码。

问题1:如何获取上述代码中标记为“this changes”的3个字段的值,并将其提交给当前帖子?

问题2:我是否需要在我的密码代码中添加任何内容,这些内容在每次发布时都会被散列。

https://ps.lphs.net/public/home.html <-超文本标记语言代码登录页面的链接。

Picture of form data on chrome

代码语言:javascript
复制
import requests


payload = {
    'pstoken': 'this changes',
    'contextData': 'this changes',
    'dbpw': 'this changes',
    'translator_username': '',
    'translator_password': '',
    'translator_ldappassword': '',
    'serviceName':' PS Parent Portal',
    'serviceTicket':'',
    'pcasServerUrl':' /',
    'credentialType':'User Id and Password Credential',
    'account':'200276',
    'pw':'my password',
    'translatorpw':''
}

head = {'User-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3180.0 Safari/537.36'}

with requests.Session() as s:
    p = s.post('https://ps.lphs.net/public/', data=payload, headers=head)

    r = s.get('https://ps.lphs.net/guardian/home.html')
    print(r.text)

编辑1:

代码语言:javascript
复制
    s.headers = {
        'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3180.0 Safari/537.36'}

    p = s.get('https://ps.lphs.net/guardian/home.html')
    print(p.text)

    r = s.post('https://ps.lphs.net/guardian/home.html', data=payload,
               headers={'Content-Type': 'application/x-www-form-urlencoded',
                        'Referer': 'https://ps.lphs.net/public/home.html'})

    print(r.text)
EN

回答 1

Stack Overflow用户

发布于 2017-10-23 14:22:39

试试看。它应该为您获取有效的响应:

代码语言:javascript
复制
import requests

payload = {
    'pstoken': 'this changes',
    'contextData': 'this changes',
    'dbpw': 'this changes',
    'translator_username': '',
    'translator_password': '',
    'translator_ldappassword': '',
    'serviceName':' PS Parent Portal',
    'serviceTicket':'',
    'pcasServerUrl':' /',
    'credentialType':'User Id and Password Credential',
    'account':'200276',
    'pw':'my password',
    'translatorpw':''
}

with requests.Session() as s:
    s.headers={'User-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3180.0 Safari/537.36'}
    r = s.post('https://ps.lphs.net/guardian/home.html',data=payload,
                headers={'Content-Type': 'application/x-www-form-urlencoded',
                        'Referer':'https://ps.lphs.net/public/home.html'})
    print(r.text)

顺便说一句,更改payload中的参数(如果需要)即可登录。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46881380

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档