Cloud-CV / Cloud-CV/evalai-cli

Abstracting the request pattern.

Open
#81 2 comments 1 reaction 0 assignees View on GitHub
enhancement good first issue GSOC-2019 help wanted
Dominant language
Python
Stars
57
Forks
70
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.