Ejemplo n.º 1
0
                   confirmation_response.text)[0].split()[-1]
    request_number = int(_.lstrip("#"))

    # Get the download scripts for our request number.
    url = "https://dataportal.eso.org/rh/requests/{}".format(eso.USERNAME)
    print("Retrieving remote paths for request number {}/{}: {}".format(
        i + 1, I, request_number))

    # Check if ESO is ready for us.
    while True:

        # Login to ESO.
        eso = ESO()
        eso.login("andycasey")

        check_state = eso._request("GET", "{}/recentRequests".format(url))
        root = BeautifulSoup(check_state.text, "html5lib")

        link = root.find(
            href="/rh/requests/{}/{}".format(eso.USERNAME, request_number))
        image = link.find_next("img")
        state = image.attrs["alt"]

        print("Current state {} on request {} ({}/{})".format(
            state, request_number, i + 1, I))

        if state != "COMPLETE":

            # Remove anything from the astroquery cache.
            for cached_file in glob(os.path.join(eso.cache_location, "*")):
                os.remove(cached_file)
Ejemplo n.º 2
0
        data=data)
    assert confirmation_response.ok

    # Parse the request number so that we can get a download script from ESO later
    _ = re.findall("Request #[0-9]+\w",
                   confirmation_response.text)[0].split()[-1]
    request_number = int(_.lstrip("#"))

    print("Retrieving remote paths for request number {}/{}: {}".format(
        i + 1, I, request_number))

    # Check if ESO is ready for us.
    while True:

        url = "https://dataportal.eso.org/rh/requests/{}".format(ESO_USERNAME)
        check_state = eso._request("GET", url, cache=False)
        root = BeautifulSoup(check_state.text, "html5lib")

        link = root.find(
            href="/rh/requests/{}/{}".format(ESO_USERNAME, request_number))

        image = link.find_next("img")
        state = image.attrs["alt"]

        print("Current state {} on request {} ({}/{})".format(
            state, request_number, i + 1, I))

        if state != "COMPLETE":

            # Remove anything from the astroquery cache.
            for cached_file in glob(os.path.join(eso.cache_location, "*")):