Your message was too long, here's your message at the allowed limit:
When I run the following code locally it works correctly but when I run it from the Prefect cloud I get the error ImportError( cannot import name 'Github' from 'github' ```import os import requests json pyodbc pandas as pd re from prefect import flow task from azure storage blob import BlobClient BlobServiceClient from azure identity import DefaultAzureCredential #from prefect_snowflake credentials import SnowflakeCredentials from cryptography hazmat primitives import serialization from cryptography hazmat backends import default_backend #from prefect filesystems import Azure import snowflake connector import uuid import git import shutil from git import RemoteProgress from git import Repo from github import Github from azure storage blob import BlobServiceClient class CloneProgress(RemoteProgress) This is to print the progress of the clone process def update(self op_code cur_count max_count=None message='') if message print(message) @task def clean_up_local(directory) Function to clean up a directory in the local machine This function cleans up the local temporary directory param directory return if os path exists(directory) shutil rmtree(directory ignore_errors=True) hidden_path = os path join(directory ' git') if os path exists(hidden_path) shutil rmtree(' unwanted' ignore_errors=True) try os mkdir(directory) except OSError as error print(error) pass temp_path = str(uuid uuid4())[0 6] return temp_path @task def clone_git() Function to clone the git repository to local disk return status - True/False based on the status # Replace with your GitHub PAT GITHUB_TOKEN = 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 # Replace with the repository owner and name REPO_OWNER = unitedcenter-cnash REPO_NAME = prefect-production # Local directory to store the downloaded content LOCAL_REPO_PATH = downloaded_repo # Authenticate with GitHub g = Github(GITHUB_TOKEN) repo = g get_user() get_repo(REPO_NAME) # Create a local directory if it doesn't exist os makedirs(LOCAL_REPO_PATH exist_ok=True) # Download repository contents (iterating through files) # For a full clone consider using GitPython library or subprocess to execute git clone contents = repo get_contents( ) print(contents) while contents file_content = contents pop(0) print(file_content) if file_content type == dir contents extend(repo get_contents(file_content path)) else file_path = os path join(LOCAL_REPO_PATH file_content path) os makedirs(os path dirname(file_path) exist_ok=True) with open(file_path wb ) as f f write(file_content decoded_content) print( GitHub Code copied ) return True @task def delete_adls_directory() Function to delete a directory in ADLS param connect_str param container_name param prefix return blob_service_client = BlobServiceClient from_connection_string( BlobEndpoint=<https //prefectscriptspy blob core windows net/;QueueEndpoint=https //prefectscriptspy queue core windows net/;FileEndpoint=https //prefectscriptspy file core windows net/;TableEndpoint=https //prefectscriptspy table core windows net/;SharedAccessSignature=sv=2024-11-04&ss=bfqt&srt=sco&sp=rwdlacupiytfx&se=2026-01-02T03 48 22Z&st=2025-11-18T19 33 22Z&spr=https&sig=HpNxmN8MKfxi6tVuc7U7s6oLnSqukhB5zAm6zcZ54FQ%3D> ) container_client = blob_service_client get_container_client(container= prefectscripts-2 ) blob_list = container_client list_blobs() new_blob_list = [] for blob in blob_list new_blob_list append(str(blob name)) print( Length ---> len(new_blob_list) type(new_blob_list)) for blb in reversed(new_blob_list) print( Deleting --> blb) container_client delete_blob(blb) @task def upload_data_to_adls(connect_str container_name path_to_remove local_path target_base_path) Function to upload local directory to ADLS return print( ADLS Container Base Path ---> target_base_path) blob_service_client = BlobServiceClient from_connection_string(connect