Comments (6)
이 패키지를 사용해서 알프레드 워크플로우를 만들어 배포했었었는데 임시 조치로 passportKey 발급받아 사용하는 것으로 해결했습니다. (완벽한 해결책은 아닙니다)
그때그때 토큰을 받아오는 것은 네이버에 너무 자주 요청을 보내게 되어 토큰을 저장해 사용하였습니다.
구체적으로는 다음과 같은 방식을 택했습니다.
- passportKey가 주어지면 해당 값 사용
- passportKey가 없고 token.txt에 값이 있으면 사용
- 문제가 생기면 새로 passportKey를 발급받아 token.txt 에 저장하고 사용
def read_token():
with open("token.txt", "r") as f:
TOKEN = f.read()
return TOKEN
def update_token(agent):
"""update passportkey
from https://gist.github.com/AcrylicShrimp/4c94db38b7d2c4dd2e832a7d53654e42
"""
html = agent.get(url='https://search.naver.com/search.naver?where=nexearch&sm=top_hty&fbm=1&ie=utf8&query=맞춤법검사기')
match = re.search('passportKey=([a-zA-Z0-9]+)', html.text)
if match is not None:
TOKEN = parse.unquote(match.group(1))
with open("token.txt", "w") as f:
f.write(TOKEN)
return TOKEN
전체 커밋은 kw-lee/alfhanspell@5826618 에서 확인하실 수 있습니다.
민감한 정보가 아니라 로컬에 저장해도 문제가 없어 임시로 텍스트파일에 저장하는 식으로 구현하였는데, 패키지에서 구현하려면 임시 파일(tmpfile)이나 쿠키를 사용해서 토큰을 저장 및 불러오는 방식을 고려해보시면 어떨까합니다.
from py-hanspell.
조만간 fix 올리겠습니다.
from py-hanspell.
오류가 떠서 이유를 찾다보니.. base_url 변수의 주소에서 "유효한 키값이 아닙니다"라고 return하는 것같아요
from py-hanspell.
@Mr-taek 넵 맞습니다. 새로운 파라미터(passportKey)가 추가 되었는데 이 값이 없으면 동작하지 않습니다.
from py-hanspell.
현재 며칠 살펴보니 하루에 한번 바뀌는것 같아요 아마도 자정이 넘어가는때 쯤인것 같습니다.
from py-hanspell.
@kw-lee 괜찮은 아이디어 인것 같네요!
from py-hanspell.
Related Issues (20)
- 맞춤법 검사 모듈 횟수 제안
- spell_checker.check()을 하기 전에 필요한 전처리가 무엇인가요?
- JSONDecodeError: Expecting value: line 1 column 1 (char 0) 에러 발생
- spell_checker 적용하신분중 정상작동하시나요 HOT 4
- JSONDecodeError: Expecting value; line1 column 1(char0) 오류 HOT 17
- JSONDecodeError: Expecting value: line 1 column 1 (char 0)
- purple_text
- hanspell 단점
- KeyError: 'result' HOT 6
- 스펠체커 오류 픽스 예상 일정 관련 HOT 1
- py-hanspell spell_checker.check 사용 시 KeyError: 'result' HOT 11
- sepell_checker 관련하여 HOT 1
- KeyError: 'result' HOT 1
- KeyError
- KeyError: Result 에러에 대한 간단한 해결책 공유드립니다. HOT 1
- KeyError: Result 에러 해결 방법을 좀 더 간편하게 수정해 보았습니다. HOT 1
- result error 해결 방법 2가지 모두 사용했는데 계속 오류가 생깁니다. HOT 2
- [이슈 문의] KeyError: 'result' HOT 2
- 패키지 설치 오류 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from py-hanspell.