def _pybossa_req(method, domain, id=None, payload=None, params={},<EOL>headers={'<STR_LIT>': '<STR_LIT:application/json>'},<EOL>files=None):
url = _opts['<STR_LIT>'] + '<STR_LIT>' + domain<EOL>if id is not None:<EOL><INDENT>url += '<STR_LIT:/>' + str(id)<EOL><DEDENT>if '<STR_LIT>' in _opts:<EOL><INDENT>params['<STR_LIT>'] = _opts['<STR_LIT>']<EOL><DEDENT>if method == '<STR_LIT>':<EOL><INDENT>r = requests.get(url, params=params)<EOL><DEDENT>elif method == '<STR_LIT>':<EOL><INDENT>if files is None and headers['<STR_LIT>'] == '<STR_LIT:application/json>':<EOL><INDENT>r = requests.post(url, params=params, headers=headers,<EOL>data=json.dumps(payload))<EOL><DEDENT>else:<EOL><INDENT>r = requests.post(url, params=params, files=files, data=payload)<EOL><DEDENT><DEDENT>elif method == '<STR_LIT>':<EOL><INDENT>r = requests.put(url, params=params, headers=headers,<EOL>data=json.dumps(payload))<EOL><DEDENT>elif method == '<STR_LIT>':<EOL><INDENT>r = requests.delete(url, params=params, headers=headers,<EOL>data=json.dumps(payload))<EOL><DEDENT>if r.status_code // <NUM_LIT:100> == <NUM_LIT:2>:<EOL><INDENT>if r.text and r.text != '<STR_LIT>':<EOL><INDENT>return json.loads(r.text)<EOL><DEDENT>else:<EOL><INDENT>return True<EOL><DEDENT><DEDENT>else:<EOL><INDENT>return json.loads(r.text)<EOL><DEDENT>
Send a JSON request.

Returns True if everything went well, otherwise it returns the status
code of the response.