def last_natural_occurrence(self, dt=None):
        dt = date_now() if dt is None else dt
        date_seconds = date_to_seconds(dt)
        offset = self.offset if self.offset else epoch_date()
        offset_seconds = date_to_seconds(offset)

        return seconds_to_date(date_seconds - ((date_seconds - offset_seconds) % self.frequency_in_seconds))
    def last_natural_occurrence(self, dt=None):
        dt = date_now() if dt is None else dt
        date_seconds = date_to_seconds(dt)
        offset = self.offset if self.offset else epoch_date()
        offset_seconds = date_to_seconds(offset)

        return seconds_to_date(date_seconds - (
            (date_seconds - offset_seconds) % self.frequency_in_seconds))
Beispiel #3
0
def get_temp_url(container_name, method, storage_url, temp_key, file_path,
                 expire_date):

    exp_seconds = date_to_seconds(expire_date)
    split = storage_url.split("/v1/")
    base_url = split[0]
    file_url_path = "/v1/" + split[1] + "/" + container_name + "/" + file_path

    hmac_body = method + "\n" + str(exp_seconds) + "\n" + file_url_path
    h = hmac.new(temp_key, msg=hmac_body, digestmod=sha1)
    tempUrlSig = h.hexdigest()
    return base_url + file_url_path + "?temp_url_sig=" + tempUrlSig + \
           "&temp_url_expires=" + str(exp_seconds)
def get_temp_url(container_name, method, storage_url,
                 temp_key, file_path, expire_date):

    exp_seconds = date_to_seconds(expire_date)
    split = storage_url.split("/v1/")
    base_url = split[0]
    file_url_path = "/v1/" + split[1]+ "/" + container_name + "/" + file_path



    hmac_body = method + "\n" + str(exp_seconds) + "\n" + file_url_path
    h = hmac.new(temp_key, msg=hmac_body, digestmod=sha1)
    tempUrlSig = h.hexdigest()
    return base_url + file_url_path + "?temp_url_sig=" + tempUrlSig + \
           "&temp_url_expires=" + str(exp_seconds)