1414
1515
1616def harvest_issue_identifiers (
17- collection_acron , from_date , until_date , force_update , timeout = 30
17+ collection_acron , from_date , until_date , force_update , timeout = 30 , verify = False
1818):
19+ # chamado em core/issue/tasks.py
1920 try :
2021 harvester = AMHarvester (
2122 record_type = "issue" ,
2223 collection_acron = collection_acron ,
2324 from_date = from_date ,
2425 until_date = until_date ,
26+ verify = verify
2527 )
2628 yield from harvester .harvest_documents ()
2729
@@ -40,7 +42,7 @@ def harvest_issue_identifiers(
4042 )
4143
4244
43- def harvest_and_load_issue (user , url , code , collection_acron , processing_date , force_update , timeout = 30 ):
45+ def harvest_and_load_issue (user , url , code , collection_acron , processing_date , force_update , timeout = 30 , verify = False ):
4446 if not url :
4547 raise ValueError ("URL is required to harvest and load issue" )
4648
@@ -50,7 +52,7 @@ def harvest_and_load_issue(user, url, code, collection_acron, processing_date, f
5052 if not collection_acron :
5153 raise ValueError ("Collection acronym is required to harvest and load issue" )
5254
53- harvested_data = harvest_issue_data (url , timeout = timeout )
55+ harvested_data = harvest_issue_data (url , timeout = timeout , verify = verify )
5456 am_issue = load_am_issue (
5557 user ,
5658 Collection .objects .get (acron3 = collection_acron ),
@@ -60,16 +62,17 @@ def harvest_and_load_issue(user, url, code, collection_acron, processing_date, f
6062 harvested_data ,
6163 force_update = force_update ,
6264 timeout = timeout ,
65+ verify = verify ,
6366 )
6467 if not am_issue :
6568 raise ValueError (f"Unable to create am_issue for { url } " )
6669 return create_issue_from_am_issue (user , am_issue )
6770
6871
69- def harvest_issue_data (url , timeout = 30 ):
72+ def harvest_issue_data (url , timeout = 30 , verify = False ):
7073 try :
7174 item = {}
72- item ["data" ] = utils .fetch_data (url , json = True , timeout = timeout , verify = False )
75+ item ["data" ] = utils .fetch_data (url , json = True , timeout = timeout , verify = verify )
7376 item ["status" ] = "pending"
7477 return item
7578 except Exception as e :
@@ -96,14 +99,15 @@ def load_am_issue(
9699 force_update ,
97100 do_harvesting = False ,
98101 timeout = 30 ,
102+ verify = False ,
99103):
100104 try :
101105 if not url :
102106 raise ValueError ("URL is required to load AMIssue" )
103107
104108 # Corrigido: não redefine harvested_data se já existe
105109 if do_harvesting or not harvested_data :
106- harvested_data = harvest_issue_data (url , timeout = timeout )
110+ harvested_data = harvest_issue_data (url , timeout = timeout , verify = verify )
107111
108112 return AMIssue .create_or_update (
109113 pid = pid ,
@@ -132,7 +136,7 @@ def load_am_issue(
132136 return None
133137
134138
135- def complete_am_issue (user , am_issue ):
139+ def complete_am_issue (user , am_issue , verify = False ):
136140 try :
137141 detail = {}
138142
@@ -144,7 +148,7 @@ def complete_am_issue(user, am_issue):
144148 if not am_issue .url :
145149 raise ValueError ("am_issue.url is required" )
146150
147- harvested_data = harvest_issue_data (am_issue .url )
151+ harvested_data = harvest_issue_data (am_issue .url , verify = verify )
148152 detail ["harvested_data" ] = str (harvested_data )
149153 am_issue .status = harvested_data .get ("status" )
150154 am_issue .data = harvested_data .get ("data" )
@@ -160,7 +164,7 @@ def complete_am_issue(user, am_issue):
160164 )
161165
162166
163- def get_issue_data_from_am_issue (am_issue , user = None ):
167+ def get_issue_data_from_am_issue (am_issue , user = None , verify = False ):
164168 """
165169 Extrai e ajusta dados do AMIssue para criação de Issue.
166170
@@ -183,7 +187,7 @@ def get_issue_data_from_am_issue(am_issue, user=None):
183187 am_data = am_issue .data
184188 if not am_data :
185189 if user :
186- complete_am_issue (user , am_issue )
190+ complete_am_issue (user , am_issue , verify = verify )
187191 am_data = am_issue .data
188192
189193 if not am_data :
0 commit comments