title: How to add HTTP Header Content-Length to Google Translate API call?
body: <p>I have this piece of code from <a href="https://cloud.google.com/translate/docs/translating-text#translate-translate-text-python" rel="nofollow noreferrer">https://cloud.google.com/translate/docs/translating-text#translate-translate-text-python</a></p>
  
  <pre><code>from google.cloud import translate
  import six
  
  def translate_text(text,target):
  
      translate_client = translate.Client()
  
      if isinstance(text, six.binary_type):
          text = text.decode('utf-8')
  
      result = translate_client.translate(
          text,
          target_language=target)
      print(u'Text: {}'.format(result['input']))
      print(u'Translation: {}'.format(result['translatedText']))
      print(u'Detected source language: {}'.format(
          result['detectedSourceLanguage']))
  
  txtTranslate = 'a long long text...'
  conteudo = translate_text(txtTranslate,target='pt')
  </code></pre>
  
  <p>It works well. The problem is when I have a very long text to translate, I'm getting error 411 Content-Length Required.
  How I'm supposed to add the Content-Length header to the HTTP request, and what function do I use to count the length?</p>