2323GRAPH_NAME = "sample-analytics-graph"
2424
2525def main ():
26- """
27- Main entry point: create NeptuneGraph client and call graph creation.
28- """
2926 config = Config (retries = {"total_max_attempts" : 1 , "mode" : "standard" }, read_timeout = None )
3027 client = boto3 .client ("neptune-graph" , config = config )
3128 execute_create_graph (client , GRAPH_NAME )
3229
33-
3430def execute_create_graph (client , graph_name ):
3531 try :
3632 print ("Creating Neptune graph..." )
37- response = client .create_graph (
38- graph_name = graph_name
39- )
33+ response = client .create_graph (graph_name = graph_name )
4034
41- created_graph_name = response .get ("GraphName" )
42- graph_arn = response .get ("GraphArn" )
43- graph_endpoint = response .get ("GraphEndpoint" )
35+ graph = response .get ("graph" , {})
36+ created_graph_name = graph .get ("name" )
37+ graph_arn = graph .get ("arn" )
38+ graph_endpoint = graph .get ("endpoint" )
4439
4540 print ("Graph created successfully!" )
4641 print (f"Graph Name: { created_graph_name } " )
@@ -51,7 +46,7 @@ def execute_create_graph(client, graph_name):
5146 print (f"Failed to create graph: { e .response ['Error' ]['Message' ]} " )
5247 except BotoCoreError as e :
5348 print (f"Failed to create graph: { str (e )} " )
54- except Exception as e : # <-- Add this generic catch
49+ except Exception as e :
5550 print (f"Unexpected error: { str (e )} " )
5651
5752if __name__ == "__main__" :
0 commit comments