Created
July 28, 2023 07:48
-
-
Save anna-geller/32975520c71a0742cfd821bbc5bcdb56 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
import requests | |
def extract_and_upload(file: str, bucket: str = "kestraio") -> None: | |
url = f"https://raw.githubusercontent.com/kestra-io/datasets/main/{file}" | |
response = requests.get(url) | |
data = response.content.decode("utf-8") | |
s3 = boto3.resource("s3") | |
s3.Bucket(bucket).put_object(Key=file, Body=data) | |
print(f"{url} downloaded and saved to {bucket}/{file}") | |
if __name__ == "__main__": | |
for month in range(1, 13): | |
filename = f"monthly_orders/2023_{str(month).zfill(2)}.csv" | |
extract_and_upload(filename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment