Coder Social home page Coder Social logo

kibua20 / devdocs Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 12.0 37.38 MB

Git repository for Kibua20's blog. See our web site

Home Page: https://kibua20.tistory.com/

License: GNU General Public License v3.0

Python 2.44% Shell 0.01% HTML 95.35% Jupyter Notebook 1.37% PureBasic 0.12% Gnuplot 0.14% CSS 0.08% Kotlin 0.01% Swift 0.02% Objective-C 0.01% Dart 0.42% Ruby 0.04%
python rest-api

devdocs's Introduction

https://kibua20.tistory.com/ 블로그에서 설명한 소스 코드입니다. 실제 동작하는 코드로 상세 내용은 블로그를 방문해주세요. 댓글로 질문을 남겨주시면 제가 아는 범위에서는 답변을 달아드립니다.

devdocs's People

Contributors

adcplge avatar kibua20 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

devdocs's Issues

안녕하세요 선생님 Python을 이용해서 Gmail API Reply보내기 해답을 찾은것 같아 이렇게 이슈로 남기게 됬습니다.

블로그 댓글을 작성하면 코드가 잘 작성되지 않아 이렇게 깃헙이슈로 남기게 됬습니다.

해당 게시글에 더해 Reply를 보내는 방법을 찾다가 해답을 찾아서 이렇게 남기게 됬습니다.

선생님이 블로그에 작성해주신 코드 주소

70~73번째 줄의

  try:
    return {'raw': base64.urlsafe_b64encode(message.as_string())}
  except:
    return {'raw': base64.urlsafe_b64encode(message.as_bytes()).decode('utf8')}

위에 해당하는 코드를

    try:
        return {'raw': base64.urlsafe_b64encode(message.as_string()), 'threadId': '스레드 ID(숫자)'}
    except:
        return {'raw': base64.urlsafe_b64encode(message.as_bytes()).decode('utf8'), 'threadId': '스레드 ID(숫자)'}

로 바꾸어 주었더니 해당 스레드에 Reply형식으로 메일이 보내졌습니다.

스레드라 함은 알고보니 그냥 한개의 메일을 Gmail에서는 스레드라고 하는것 같았습니다.

Screen Shot 2022-01-09 at 5 17 26 PM

위의 사진처럼 스레드 ID는 단순히 스레드 ID를 알고싶은 메일에 들어가서 주소창을 보면 맨끝의 FMfcgzGmtNdjmjGGmWGwgxVvzqQrXdfh와 같은 문자로 알수 있는데요.

이 문자는 스레드 ID가 맞긴 하지만 실제로 저희의 Python 코드에는 숫자형식의 스레드 ID가 들어가야했습니다.

그래서 해당 문자를 숫자형식의 스레드 ID로 바꾸는 방법은 여기에서 알수 있었습니다.

document.querySelector('[data-legacy-thread-id]').getAttribute('data-legacy-thread-id')

해당 JS를 확인하고싶은 메일에 들어가서 개발자도구를 열어 console창에 복붙하시게 되면 숫자 형식의 스레드 아이디를 확인하실수 있습니다.

이렇게 얻은 스레드 ID를 저희 파이썬 코드에 넣으면 정상적으로 Reply 메일이 보내집니다.

다시한번 훌륭한 글을 작성해주셔서 너무 감사드립니다!!

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.