yihong0618/tg_bing_dalle

run error --- 'NoneType' object has no attribute 'extract_cookies'

burndown opened this issue · 2 comments

更新完报错。
tg_toke 和 bing_cookie 都检查过了。
服务器在美国,应该不存在访问限制的问题。

heigao@bwg:~/tg_bing2/tg_bing_dalle$ python3 tg.py $tg_token $bing_cookie
Arg parse done.
Bot init done.
your 24 cookie is wrong please check error: 'NoneType' object has no attribute 'extract_cookies'
Traceback (most recent call last):
  File "/home/heigao/tg_bing2/tg_bing_dalle/tg.py", line 161, in <module>
    main()
  File "/home/heigao/tg_bing2/tg_bing_dalle/tg.py", line 81, in main
    image_obj.get_limit_left()
  File "/home/heigao/.local/lib/python3.10/site-packages/BingImageCreator.py", line 104, in get_limit_left
    r = self.session.get("https://www.bing.com/create")
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 557, in get
    return self.request('GET', url, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 544, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 673, in send
    extract_cookies_to_jar(self.cookies, request, r.raw)
  File "/usr/lib/python3/dist-packages/requests/cookies.py", line 132, in extract_cookies_to_jar
    jar.extract_cookies(res, req)
AttributeError: 'NoneType' object has no attribute 'extract_cookies'

heigao@bwg:~/tg_bing2/tg_bing_dalle$ echo $bing_cookie
_IDET=VSNoti2=20230306&MIExp=0; ipv6=hit=1700449202956&t=4; MUID=29740A3C59DC61AD0E8618FA58A6603E; SRCHD=AF=NOFORM; SRCHUID=V=2&GUID=71484B96A1B24033B0E4A37B7D0AB621&dmnchg=1; MUIDB=29740A3C59DC61AD0E8618FA58A6603E; _UR=QS=0&TQS=0; MMCASM=ID=A937CF8A3A334A8A848A2D6D6229A6E2; MicrosoftApplicationsTelemetryDeviceId=492bef10-8018-40c4-8e74-06787f6037df; EDGSRVCUSR=udscdxtone=Creative; PPLState=1; SnrOvr=X=rebateson; ABDEF=V=13&ABDV=11&MRNB=1679380599512&MRB=0; _HPVN=CS=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595000&POEX=W; _Rwho=u=d; _SS=SID=207DF0DD84DA6A740571E31285436B20&R=403&RB=403&GB=0&RG=0&RP=403; GI_FRE_COOKIE=gi_prompt=2&gi_sc=1; _RwBf=W=1&ilt=1&ihpd=0&ispd=1&rc=403&rb=403&gb=0&rg=0&pc=403&mtu=0&rbb=0.0&g=0&cid=&clo=0&v=2&l=2023-11-19T08:00:00.0000000Z&lft=0001-01-01T00:00:00.0000000&aof=0&o=0&p=bingcopilotwaitlist&c=MY00IA&t=1352&s=2023-02-08T00:22:22.3026774+00:00&ts=2023-11-20T02:00:11.6448886+00:00&rwred=0&wls=2&lka=0&lkt=0&TH=&r=1&mta=0&e=8bwyNw3ddMPGmdw4D3qRt3RsYdwQfVqNajmPcVziC6AfJo6e4sMW4PpVuxfc37L_IAzuLLUjS_O-CyckpihqSYg2P0GC-z2qkI5QolOb6iE&A=&mte=0&dci=0&wlb=0&aad=0; _EDGE_S=SID=207DF0DD84DA6A740571E31285436B20&mkt=en-us&ui=en-us; SRCHHPGUSR=SRCHLANG=en&DM=0&WTS=63825153443&PV=10.0.0&HV=1700179987&BRW=S&BRH=T&CW=1067&CH=1006&SCW=1067&SCH=1006&DPR=1.0&UTC=480&PRVCW=1912&PRVCH=1006&EXLTT=20&cdxtone=Creative&TH=ThRb&cdxts=1&PR=1.5&IG=C0471D71754247D2BB3B9372A396C13E&CIBV=1.1359.4

cookie 用引号包裹

搞定!