INtegrating monday API in python on oozie

Here is my code:

import requests
import json
import sys, subprocess, datetime, json, math
def querySprintDetails(api_key, board_id ):
    headers = {"Authorization" : api_key}
    monday_url = ''
    # store request body in a dict, including variables
    req_data = {"query" : "{boards(ids:%d) { \
                                items { \
                                  id \
                                  name \
                                  column_values{title text} \
                                  group{title} \
    # make HTTP POST using requests
    r =, json=req_data, headers=headers)
    if r.status_code != 200:  # throw exception
        print('Status:', r.status_code)
        return -1
    return r

r = querySprintDetails( api_key, board_id )

When I run directly this works. Whereas when I try to schedule this on oozie it starts failing

Traceback (most recent call last):
  File "./", line 79, in <module>
    r = querySprintDetails( api_key, board_id )
  File "./", line 27, in querySprintDetails
    r =, json=req_data, headers=headers)
  File "/grid/5/tmp/yarn-local/usercache/ma_d/appcache/application_1572358313567_19492469/container_e17_1572358313567_19492469_01_000001/python36/lib/python3.6/site-packages/requests/", line 112, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/grid/5/tmp/yarn-local/usercache/ma_d/appcache/application_1572358313567_19492469/container_e17_1572358313567_19492469_01_000001/python36/lib/python3.6/site-packages/requests/", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/grid/5/tmp/yarn-local/usercache/ma_d/appcache/application_1572358313567_19492469/container_e17_1572358313567_19492469_01_000001/python36/lib/python3.6/site-packages/requests/", line 512, in request
    resp = self.send(prep, **send_kwargs)
  File "/grid/5/tmp/yarn-local/usercache/ma_d/appcache/application_1572358313567_19492469/container_e17_1572358313567_19492469_01_000001/python36/lib/python3.6/site-packages/requests/", line 622, in send
    r = adapter.send(request, **kwargs)
  File "/grid/5/tmp/yarn-local/usercache/ma_d/appcache/application_1572358313567_19492469/container_e17_1572358313567_19492469_01_000001/python36/lib/python3.6/site-packages/requests/", line 513, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='', port=443): Max retries exceeded with url: /v2 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f1c09787e10>: Failed to establish a new connection: [Errno 110] Connection timed out',))
Failing Oozie Launcher, Main class [org.apache.oozie.action.hadoop.ShellMain], exit code [1]

Is it accessing wrong port? If yes, what port should i direct it to?
Using python 3.6

I am a noob. Sorry if this is a very basic question.