import requests
import logging


def odata_getone(url, headers):
    """
    Get a single object from Odata
    """
    r = requests.get(url, headers=headers)
    if not r.ok:
        logging.warning(f"Fetch url {url} hit {r.status_code}")
        return None
    rjson = r.json()
    if 'error' in rjson:
        logging.warning(f"Fetching of {url} returned error {r.text}")
        return None
    return rjson