beomi / pypapago Goto Github PK
View Code? Open in Web Editor NEWπ§[Archived][Unofficial] Python wrapper for Papago translation service
Home Page: https://beomi.github.io/2019/07/08/Papago-API-with-Python/
License: MIT License
π§[Archived][Unofficial] Python wrapper for Papago translation service
Home Page: https://beomi.github.io/2019/07/08/Papago-API-with-Python/
License: MIT License
I have this problem:
Traceback (most recent call last):
File "sub.py", line 1624, in
result = translator.translate(i.content, source='en', target='vi',)
File "C:\Python38\lib\site-packages\pypapago\translator.py", line 60, in translate
return response.json()['translatedText']
KeyError: 'translatedText'
How to fix it?
μ§κΈ 보λκΉ μλ μΈμ΄ κ°μ§λ μλ κ² κ°λλ°, μΆκ°μ’ ν΄μ£Όμλ©΄ κ°μ¬νκ² μ΅λλ€.
μλ νμΈμ?
ννκ³ dataλ₯Ό λΆμνλ κΈμ 보μλλ°μ, μ κ° ν΄λ³΄λ μ§κΈ ννκ³ μ¬μ΄νΈμμμ μμ² dataκ° λ³κ²½λ κ² κ°μμ.
νΉμ νμΈ κ°λ₯νμ κ°μ?
ννκ³ μμ μ
λ ₯λμ§ μμ λ¨μ΄λ₯Ό μ°λ©΄ KeyErrorκ° λμ€λλ°μ.
translator.pyμ μλ μ½λλ₯Ό 보λ μ΄μ§ λ¬Έμ κ° μλ κ² κ°μμ λ§μ λ립λλ€.
59μ€λΆν° μ΄λ κ² μ°μλ©΄ λ κ² κ°μ΅λλ€.
if not verbose:
if 'translatedText' in response.json():
return response.json()['translatedText']
else:
return ''
Hi,
When using the module today, this response message came out (after switching to verbose mode):
{'code': '00001', 'message': 'μ¬λ°λ₯Έ μ κ·Όμ΄ μλλλ€.', 'displayMessage': 'μΌμμ μΈ μ€λ₯λ‘ μλΉμ€λ₯Ό μ΄μ©ν μ μμ΅λλ€.\nμ μ ν λ€μ μλν΄μ£ΌμΈμ.'}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.