Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
luc wastiaux committed May 27, 2021
1 parent 624a171 commit f39a083
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions awesometts/service/naver.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@

# This function implements function I(a,t) found at
# https://papago.naver.com/main.87cbe57a9fc46d3db5c1.chunk.js
# 2021/05/27 update:
# HMAC_KEY has changed, and the timestamp is now in milliseconds

def _compute_token(timestamp, uuid_str):
msg = uuid_str + '\n' + TRANSLATE_MKID + '\n' + timestamp
Expand All @@ -161,9 +163,6 @@ def _generate_headers():
timestamp_str = str(int(timestamp_milliseconds))
auth = _compute_token(timestamp_str, UUID)

# auth='PPG 15b4b888-3839-46e2-926e-05612601d92b:9CTJD16jlIY7BTHzy/bcKw=='
# timestamp='1622099405030'

return {'authorization': auth,
'timestamp': timestamp_str,
'Content-Type': 'application/x-www-form-urlencoded',
Expand Down Expand Up @@ -240,6 +239,9 @@ def run(self, text, options, path):
sound_id = response_data['id']
self._logger.info(f'retrieved sound_id successfully: {sound_id}')

# actually retrieve sound file
# ============================

final_url = TRANSLATE_ENDPOINT + sound_id
self._logger.info(f'final_url: {final_url}')

Expand Down

0 comments on commit f39a083

Please sign in to comment.