0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

DeepLやーる(Windows 10、Python3.6)

Last updated at Posted at 2022-01-26

はじめに

DeepLやーる

開発環境

  • Windows 10 PC
  • Python3.6

実装

1.無料版に登録

2.認証キーをコピーする

3.下記プログラムを実行

test.py
import requests

auth_key = "<insert your api key>"
text = "Hello, world"
target_lang = "JA"
url = f"https://api-free.deepl.com/v2/translate?auth_key={auth_key}&text={text}&target_lang={target_lang}"
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, headers=headers)
print(response.json())

4.実行結果

(py36) D:\PythonProjects\DeepL>python test.py
{'translations': [{'detected_source_language': 'EN', 'text': 'ハロー、ワールド'}]}

お疲れ様でした。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?