Giter Club home page Giter Club logo

ruclogin's Introduction

  • 👋 Hi, I’m @panjd123

Anurag's GitHub stats

ruclogin's People

Contributors

panjd123 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

borel-peng

ruclogin's Issues

list index out of range

当执行ruclogin.py时会有报错,使用的是Edge浏览器配合官方驱动

list index out of range

经检查是处理cookie时split函数出错,即在代码jw_cookies = get_cookies(domain="jw", cache=False)的时候抛出的异常,也就是经由浏览器驱动获取微人大教务系统时没有正确处理cookie。

将代码修改成:

class RUC_LOGIN:
...
    def get_cookies(self, domain="v"):
        ...
        elif domain.startswith("jw"):
            [
                self.driver.wait_for_request(
                    url,
                    timeout=10,
                )
                for url in [
                    "/Njw2017/index.html*",
                    "/secService/oauthlogin*",
                ]
            ]
            cookies = {}
            for request in self.driver.requests:
                if request.response:
                    cookie_header = request.response.headers["Set-Cookie"]
                    if cookie_header:
                        for cookie in cookie_header.split(", "):
                            if "=" in cookie and ";" in cookie:
                                cookies.update(
                                    {
                                        cookie.split("=")[0]: cookie.split("=")[1].split(";")[0]
                                    }
                            )
            return cookies

后正常工作。
原本的代码cookie.split("=")[0]: cookie.split("=")[1].split(";")[0]假设每个 cookie 都包含至少一个 "=" 和一个 ";"。如果有任何 cookie 不满足这个条件,那么 split("=")[1] 或 split(";")[0] 就会引发 "list index out of range" 错误。

Suggestion to Use `getpass.getpass` for Secure Password Input

I suggest adopting getpass.getpass from the Python standard library for password inputs in our GitHub project. This is a common practice that hides passwords from the screen, providing a more secure user experience. It's a standard and effective approach to enhance credential protection in Python applications.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.