Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

list index out of range #16

Open
Judenause opened this issue Jan 15, 2023 · 4 comments
Open

list index out of range #16

Judenause opened this issue Jan 15, 2023 · 4 comments

Comments

@Judenause
Copy link

Judenause commented Jan 15, 2023

안녕하세요. 좋은 프로그램 만들어주셔서 감사드립니다.
제가 오늘 처음 받아서 사용해 보려고 하는데, list index out of range와 같은 에러가 계속 발생하였습니다.

[2023_0115_181657]
[진행중] Notion 로그인 완료
====== 업로드/수정 예정 목록 ======
[상태:발행 요청] 게시물: N2T 테스트 페이지
[진행중] Selenium 준비중...
[진행중] Selenium Chrome WebDriver 시작..
[진행중] Selenium으로 티스토리(카카오) 로그인중..
[진행중] 카카오 로그인 재시도..
[진행중] Selenium으로 티스토리(카카오) 로그인 완료!
**AUTH_TEST:**
Traceback (most recent call last):
  File "/home/sjh_iris/N2T/main.py", line 163, in <module>
    client = Notion2Tistory(cfg, sleep_time=5, selenium_debug=False)
  File "/home/sjh_iris/N2T/main.py", line 56, in __init__
    authorize_code = self.s_client.get_tistory_authorize_code(cfg.TISTORY.CLIENT_ID, cfg.TISTORY.REDIRECT_URI)
  File "/home/sjh_iris/N2T/clients/SeleniumClient.py", line 77, in get_tistory_authorize_code
    code = soup.script.text.split('code=')[1].split('&state')[0]
**IndexError: list index out of range**

확인을 위해서

print("AUTH_TEST:",soup.script.text) 

구문을 추가하였는데 아무것도 나오지가 않습니다.
설정이 잘못되어 있는 것일까요?

soup.script.string.split('code=')[1].split('&state')[0]

로 수정하였을 때는

AttributeError: 'NoneType' object has no attribute 'split'

다음과 같은 에러가 나오게 됩니다.
감사합니다.

@espriter
Copy link

espriter commented Feb 6, 2023

저도 동일한 케이스였는데 soup 전체를 print 해보시겠어요?
그렇게 해서 OAuth 페이지가 아니였다면 어떤 이유로든 로그인이 되지 않은 상황입니다.

저 같은 경우 '카카오 2단계 인증' 걸어놓은걸 깜빡하고 휴대폰 인증을 안해주니 계속 인증이 풀리는 상황이었습니다.
2단계 인증 해지하고 다시 돌려보니 문제 없이 작동하네요.

@towhereim
Copy link

안녕하세요. 좋은 프로그램 만들어주셔서 감사드립니다. 제가 오늘 처음 받아서 사용해 보려고 하는데, list index out of range와 같은 에러가 계속 발생하였습니다.

[2023_0115_181657]
[진행중] Notion 로그인 완료
====== 업로드/수정 예정 목록 ======
[상태:발행 요청] 게시물: N2T 테스트 페이지
[진행중] Selenium 준비중...
[진행중] Selenium Chrome WebDriver 시작..
[진행중] Selenium으로 티스토리(카카오) 로그인중..
[진행중] 카카오 로그인 재시도..
[진행중] Selenium으로 티스토리(카카오) 로그인 완료!
**AUTH_TEST:**
Traceback (most recent call last):
  File "/home/sjh_iris/N2T/main.py", line 163, in <module>
    client = Notion2Tistory(cfg, sleep_time=5, selenium_debug=False)
  File "/home/sjh_iris/N2T/main.py", line 56, in __init__
    authorize_code = self.s_client.get_tistory_authorize_code(cfg.TISTORY.CLIENT_ID, cfg.TISTORY.REDIRECT_URI)
  File "/home/sjh_iris/N2T/clients/SeleniumClient.py", line 77, in get_tistory_authorize_code
    code = soup.script.text.split('code=')[1].split('&state')[0]
**IndexError: list index out of range**

확인을 위해서

print("AUTH_TEST:",soup.script.text) 

구문을 추가하였는데 아무것도 나오지가 않습니다. 설정이 잘못되어 있는 것일까요?

soup.script.string.split('code=')[1].split('&state')[0]

로 수정하였을 때는

AttributeError: 'NoneType' object has no attribute 'split'

다음과 같은 에러가 나오게 됩니다. 감사합니다.

TISTORY openAPI에 서비스 URL, CallBack URL이 https로 되어 있는지 확인해보세요.
로그인완료되고 나온 SOUP의 title에는 Tistory OAUTH가 있어야 합니다.
image

@Gaegul2moja
Copy link

동일한 문제가 발생하고 있는데, 혹 해결하셨을까요?

@Gaegul2moja
Copy link

동일한 문제가 발생하고 있는데, 혹 해결하셨을까요?

해결하여 댓글남깁니다 혹 비슷한 케이스의 분들이 계실경우 참고 하시면 좋을 듯합니다.
SeleniumClient.py 의 72줄 이후에 아래 authorize_url 을 확인하시어 해당 값을 브라우저에 붙여 넣었을 때 정상적으로 아래와 같은 페이지가 보이는지 확인이 필요합니다.
print('0.',authorize_url)
image

만일 해당 페이지가 아닌 블로그의 홈이 보이는 경우 client_id 혹은 redirect_url 이 잘못된 상태로 redirectUrl 의 끝에 / 가 포함되었는지 여부의 확인이 필요합니다. (본인의 경우는 해당 이슈 였습니다..)

개발자님의 노고에 감사드리며, 부디 관련 이슈가 발생하신 분들이 잘 해결되시길 바랍니다! 👍

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

No branches or pull requests

4 participants