# Buggy code
def _args_to_payload(self, *args, **kwargs):
    # convert arguments to a valid requests payload
    # and force the coordinates to FK5 (assuming FK5/ICRS are
    # interchangeable) since RA/Dec are used below
    coordinates = commons.parse_coordinates(kwargs["coordinates"]).fk5
    radius = kwargs["radius"]
    payload = {format: "VOTable"}
    payload["query"] = (
        "SELECT * from caom2.Observation o join caom2.Plane p "
        "ON o.obsID=p.obsID "
        "WHERE INTERSECTS( "
        "CIRCLE('ICRS', {}, {}, {}), position_bounds) = 1 AND "
        "(quality_flag IS NULL OR quality_flag != 'junk')".format(
            coordinates.ra.degree, coordinates.dec.degree, radius
        )
    )
    if "collection" in kwargs and kwargs["collection"]:
        payload["query"] = "{} AND collection='{}'".format(
            payload["query"], kwargs["collection"]
        )
    if "data_product_type" in kwargs and kwargs["data_product_type"]:
        payload["query"] = "{} AND dataProductType='{}'".format(
            payload["query"], kwargs["data_product_type"]
        )
    return payload


# Traceback (HTTPError)
---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
<ipython-input-68-f4c802433ee1> in <module>
----> 1 cadc.query_region(c, radius=1*u.deg)

~/anaconda3/lib/python3.7/site-packages/astroquery/utils/class_or_instance.py in f(*args, **kwds)
23         def f(*args, **kwds):
24             if obj is not None:
---> 25                 return self.fn(obj, *args, **kwds)
26             else:
27                 return self.fn(cls, *args, **kwds)

~/anaconda3/lib/python3.7/site-packages/astroquery/utils/process_asyncs.py in newmethod(self, *args, **kwargs)
24             verbose = kwargs.pop('verbose', False)
25
---> 26             response = getattr(self, async_method_name)(*args, **kwargs)
27             if kwargs.get('get_query_payload') or kwargs.get('field_help'):
28                 return response

~/anaconda3/lib/python3.7/site-packages/astroquery/utils/class_or_instance.py in f(*args, **kwds)
23         def f(*args, **kwds):
24             if obj is not None:
---> 25                 return self.fn(obj, *args, **kwds)
26             else:
27                 return self.fn(cls, *args, **kwds)

~/anaconda3/lib/python3.7/site-packages/astroquery/cadc/core.py in query_region_async(self, coordinates, radius, collection, get_query_payload)
165         if get_query_payload:
166             return request_payload
--> 167         response = self.run_query(request_payload['query'], operation='sync')
168         return response
169

~/anaconda3/lib/python3.7/site-packages/astroquery/cadc/core.py in run_query(self, query, operation, output_file, output_format, verbose, background, upload_resource, upload_table_name)
346                 dump_to_file=save_to_file,
347                 upload_resource=upload_resource,
--> 348                 upload_table_name=upload_table_name)
349             op = False
350         elif operation == 'async':

~/anaconda3/lib/python3.7/site-packages/astroquery/utils/tap/core.py in launch_job(self, query, name, output_file, output_format, verbose, dump_to_file, upload_resource, upload_table_name)
239             if dump_to_file:
240                 self.__connHandler.dump_to_file(suitableOutputFile, response)
--> 241             raise requests.exceptions.HTTPError(response.reason)
242         else:
243             if verbose:

HTTPError: Bad Request

# Fixed code
def _args_to_payload(self, *args, **kwargs):
    # convert arguments to a valid requests payload
    # and force the coordinates to FK5 (assuming FK5/ICRS are
    # interchangeable) since RA/Dec are used below
    coordinates = commons.parse_coordinates(kwargs["coordinates"]).fk5
    radius_deg = commons.radius_to_unit(kwargs["radius"], unit="degree")
    payload = {format: "VOTable"}
    payload["query"] = (
        "SELECT * from caom2.Observation o join caom2.Plane p "
        "ON o.obsID=p.obsID "
        "WHERE INTERSECTS( "
        "CIRCLE('ICRS', {}, {}, {}), position_bounds) = 1 AND "
        "(quality_flag IS NULL OR quality_flag != 'junk')".format(
            coordinates.ra.degree, coordinates.dec.degree, radius_deg
        )
    )
    if "collection" in kwargs and kwargs["collection"]:
        payload["query"] = "{} AND collection='{}'".format(
            payload["query"], kwargs["collection"]
        )
    if "data_product_type" in kwargs and kwargs["data_product_type"]:
        payload["query"] = "{} AND dataProductType='{}'".format(
            payload["query"], kwargs["data_product_type"]
        )
    return payload