title: Google API not compatible with python Celery Tasks?
body: <p>I have a django project, trying to execute some celery workers to perform a task in the background to update my model.  I can execute basic tasks (add .delay()) to end of method in views. ) But can not execute google api calls.  <strong>I can execute the google API calls if it is not a delayed task and it works perfectly and updates my models.  Once I make a .delay() and add to celery queue as a task, I get the ssl error at bottom.</strong> </p>
  
  <p><strong>Simple task that calls api and prints results: WORKS</strong></p>
  
  <pre><code>@task()
  def simple_api_call():
  r1=requests.get('https://jsonplaceholder.typicode.com/todos/1')
  rj1=r1.json()
  print(rj1))]
  </code></pre>
  
  <p><strong>Simple task that calls GOOGLE(youtube) api and prints results: SSL error</strong></p>
  
  <pre><code>@task
  def google_api_call()
  r1=requests.get('https://www.googleapis.com/youtube/v3/commentThreads?part=snippet%2Creplies&amp;allThreadsRelatedToChannelId=UCQMZZMfz0D1RueGzcYLd87Q&amp;searchTerms=love&amp;key=MYKEY')
  rj1=r1.json()
  print(rj1))]
  </code></pre>
  
  <p>btw you can test out the google api/get the url for the get request here (just unselect the api and oauth:
  <a href="https://developers.google.com/youtube/v3/docs/commentThreads/list?apix_params=%7B%22part%22%3A%22snippet%2Creplies%22%2C%22allThreadsRelatedToChannelId%22%3A%22UCQMZZMfz0D1RueGzcYLd87Q%22%2C%22searchTerms%22%3A%22love%22%7D" rel="nofollow noreferrer">https://developers.google.com/youtube/v3/docs/commentThreads/list?apix_params=%7B%22part%22%3A%22snippet%2Creplies%22%2C%22allThreadsRelatedToChannelId%22%3A%22UCQMZZMfz0D1RueGzcYLd87Q%22%2C%22searchTerms%22%3A%22love%22%7D</a></p>
  
  <p>SSL error when worker executes the google api call. </p>
  
  <pre><code>INFO/MainProcess] Received task: todo.tasks.update_comments[ae9bebfe-4b3c-46ec-b197-0ffa56847f30]
  
  [2019-10-31 05:33:52,652: ERROR/ForkPoolWorker-2] Task todo.tasks.update_comments[ae9bebfe-4b3c-46ec-b197-0ffa56847f30] raised unexpected: SSLError(MaxRetryError('HTTPSConnectionPool(host='www.googleapis.com', port=443): Max retries exceeded with url: /youtube/v3/commentThreads?part=replies%2Csnippet&amp;allThreadsRelatedToChannelId=UC_EyncGJh2QuQHhcfuDWL6g&amp;searchTerms=%23vi&amp;maxResults=100&amp;order=time&amp;key=xxxmyapikey (Caused by SSLError(SSLError("bad handshake: SysCallError(54, 'ECONNRESET')")))'))
  Traceback (most recent call last):
  File "/Users/tylervanzo/Desktop/trydjango/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py", line 485, in wrap_socket
  cnx.do_handshake()
  File "/Users/tylervanzo/Desktop/trydjango/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1915, in do_handshake
  self._raise_ssl_error(self._ssl, result)
  File "/Users/tylervanzo/Desktop/trydjango/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1639, in _raise_ssl_error
  raise SysCallError(errno, errorcode.get(errno))
  OpenSSL.SSL.SysCallError: (54, 'ECONNRESET')
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
  File "/Users/tylervanzo/Desktop/trydjango/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
  chunked=chunked,
  File "/Users/tylervanzo/Desktop/trydjango/lib/python3.7/site-packages/urllib3/connectionpool.py", line 376, in _make_request
  self._validate_conn(conn)
  File "/Users/tylervanzo/Desktop/trydjango/lib/python3.7/site-packages/urllib3/connectionpool.py", line 994, in validate_conn
  conn.connect()
  File "/Users/tylervanzo/Desktop/trydjango/lib/python3.7/site-packages/urllib3/connection.py", line 394, in connect
  ssl_context=context,
  File "/Users/tylervanzo/Desktop/trydjango/lib/python3.7/site-packages/urllib3/util/ssl.py", line 370, in ssl_wrap_socket
  return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/Users/tylervanzo/Desktop/trydjango/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py", line 491, in wrap_socket
  raise ssl.SSLError("bad handshake: %r" % e)
  ssl.SSLError: ("bad handshake: SysCallError(54, 'ECONNRESET')",)
  </code></pre>
  
  <p>Using redis as the broker
  here are my celery config so far </p>
  
  <pre><code>WSGI_APPLICATION = 'trydjango.wsgi.application'
  CELERY_BROKER_URL = 'redis://127.0.0.1:6379/0'
  BROKER_TRANSPORT = 'redis'
  CELERY_RESULT_BACKEND = 'django-db'
  CELERY_TIMEZONE = 'Asia/Makassar'
  </code></pre>