def get_endpoints_using_catalog_api(domain, token):
<EOL>headers = {"<STR_LIT>": token}<EOL>uri = "<STR_LIT>"<EOL>ret = []<EOL>endpoints_thus_far = set()<EOL>offset = <NUM_LIT:0><EOL>while True:<EOL><INDENT>try:<EOL><INDENT>r = requests.get(uri.format(domain, offset), headers=headers)<EOL>r.raise_for_status()<EOL><DEDENT>except requests.HTTPError:<EOL><INDENT>raise requests.HTTPError("<STR_LIT>".format(domain))<EOL><DEDENT>data = r.json()<EOL>endpoints_returned = {r['<STR_LIT>']['<STR_LIT:id>'] for r in data['<STR_LIT>']}<EOL>new_endpoints = endpoints_returned.difference(endpoints_thus_far)<EOL>if len(new_endpoints) >= <NUM_LIT>:  <EOL><INDENT>ret += data['<STR_LIT>']<EOL>endpoints_thus_far.update(new_endpoints)<EOL>offset += <NUM_LIT:1000><EOL>continue<EOL><DEDENT>else:  <EOL><INDENT>ret += [r for r in data['<STR_LIT>'] if r['<STR_LIT>']['<STR_LIT:id>'] in new_endpoints]<EOL>break<EOL><DEDENT><DEDENT>return ret<EOL>
Implements a raw HTTP GET against the entire Socrata portal for the domain in question. This method uses the
second of the two ways of getting this information, the catalog API.

Parameters
----------
domain: str
    A Socrata data portal domain. "data.seattle.gov" or "data.cityofnewyork.us" for example.
token: str
    A Socrata application token. Application tokens can be registered by going onto the Socrata portal in
    question, creating an account, logging in, going to developer tools, and spawning a token.

Returns
-------
Portal dataset metadata from the catalog API.