Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

我不明白打开12306官网可以获取headers-Cookies中的RAIL_DEVICEID,RAIL_EXPIRATION,这几个应该再那个文件里,再12306网页找不到 #850

Open
YUG-LONG opened this issue Oct 5, 2023 · 1 comment

Comments

@YUG-LONG
Copy link

YUG-LONG commented Oct 5, 2023

描述问题

我不明白,这句打开12306官网可以获取headers-Cookies中的RAIL_DEVICEID,RAIL_EXPIRATION

这个我不知道在12306网页的那里,找不到;然后也不知道应该放在哪个文件的那里

在文末有个TickerConfig.py的句段,我猜一下是不是将RAIL_DEVICEID , RAIL_EXPIRATION放在TickerConfig.py文件里。

重现步骤

  • 步骤一

    克隆项目
    git clone
    conda创建python3.6,
    conda create --name myenv python=3.6
    conda activate myenv
    
  • 步骤二

    先看到python run.py -h能行,就使用python run.py r报错(提醒装依赖)
反正run程序一次,报缺失依赖,然后安装,这样重复了好几次

pip install pillow是报错缺失PIL这个文件依赖时,的解决方法
Pillow是一个Python图像处理库,提供了类似于PIL的功能,并且与大多数Python版本兼容
反正步骤二的步骤是:
一次命令: python run.py -h   和 python run.py c


多次命令: python run.py r 根据这个报错提示,下载需要的依赖
(myenv) PS D:\project\ticket12306\12306> python run.py c
Traceback (most recent call last):
  File "run.py", line 29, in <module>
    from agency.cdn_utils import filterCdn
  File "D:\project\ticket12306\12306\agency\cdn_utils.py", line 10, in <module>
    from myUrllib.httpUtils import HTTPClient
  File "D:\project\ticket12306\12306\myUrllib\httpUtils.py", line 8, in <module>
    from fake_useragent import UserAgent

ModuleNotFoundError: No module named 'fake_useragent'
(myenv) PS D:\project\ticket12306\12306> pip install fake_useragent



ModuleNotFoundError: No module named 'fake_useragent'
这句话没搞错的话,就是说缺失fake_useragent这个依赖
  • 步骤三、

    在TickerConfig.py将账号密码和车次·信息填写了,再使用python run.py r时,报错翻译了一下,大意是

    1. 获取 headers-Cookies 中的 RAIL_DEVICEIDRAIL_EXPIRATION 的值,并将其填写到你的配置文件中。

    2. 配置文件中没有填写正确的用户名和密码

    刷新间隔: 随机(1-3S)
    僵尸票关小黑屋时长: 5
    下单接口: 2
    下单模式: 1
    预售踩点时间:12:59:57
    **************************************************
    cookie获取中
    警告!!: RAIL_DEVICEID,RAIL_EXPIRATION的值为空,请手动打开12306官网可以获取headers-Cookies中的RAIL_DEVICEID,RAIL_EXPIRATION,填入配 置文件中
    Traceback (most recent call last):
      File "run.py", line 20, in <module>
        select_ticket_info.select().main()
      File "D:\project\ticket12306\12306\init\select_ticket_info.py", line 123, in main
        self.call_login()
      File "D:\project\ticket12306\12306\init\select_ticket_info.py", line 117, in call_login
        self.login.go_login()
      File "D:\project\ticket12306\12306\init\login.py", line 119, in go_login
        if loginConf(self.session):
      File "D:\project\ticket12306\12306\inter\LoginConf.py", line 12, in loginConf
        loginConfRsp = session.httpClint.send(urls=loginConfUrl, data={})
      File "D:\project\ticket12306\12306\myUrllib\httpUtils.py", line 185, in send
        response.content.decode() if isinstance(response.content, bytes) else response.content)
      File "D:\Anaconda3\envs\myenv\lib\json\__init__.py", line 354, in loads
        return _default_decoder.decode(s)
      File "D:\Anaconda3\envs\myenv\lib\json\decoder.py", line 339, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
      File "D:\Anaconda3\envs\myenv\lib\json\decoder.py", line 357, in raw_decode
        raise JSONDecodeError("Expecting value", s, err.value) from None
    json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
    

拜托大佬解决下,谢谢

截图&日志

环境信息

  • windows
  • python3.7.1
  • 订票小助手版本 1.1.101

额外的备注

  • Add any other context about the problem here.
@YUG-LONG
Copy link
Author

YUG-LONG commented Oct 5, 2023

请大佬解决下,我的想法是,定三张高铁票(但那趟车经常没票,不会这个,不知道能否实现抢退票的功能),但不知道需要的headers-Cookies中的RAIL_DEVICEID,RAIL_EXPIRATION怎么找

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant