evalai-cli icon indicating copy to clipboard operation
evalai-cli copied to clipboard

Abstracting the request pattern.

Open guyandtheworld opened this issue 7 years ago • 2 comments

Currently, most of the request function use the same format of http request pattern except a few.

    headers = get_request_header()

    try:
        response = requests.get(url, headers=headers)
        response.raise_for_status()
    except requests.exceptions.HTTPError as err:
        if (response.status_code in EVALAI_ERROR_CODES):
            validate_token(response.json())
            echo(style("Error: {}".format(response.json()["error"]), fg="red", bold=True))
        else:
            echo(err)
        sys.exit(1)
    except requests.exceptions.RequestException as err:
        echo(err)
        sys.exit(1)

This could be simplified easily by abstracting this functionality as a function.

guyandtheworld avatar Jul 09 '18 04:07 guyandtheworld

@isht3 @RishabhJain2018 Can I work on this issue?

mahim23 avatar Mar 19 '19 07:03 mahim23

@mahim23 Sure! Once you've completed your previous issue then you can work on this. Till then it is open for others to work on.

RishabhJain2018 avatar Mar 20 '19 20:03 RishabhJain2018