urllib2.URLError: <urlopen error [Errno 10054] An existing connection was forcibly closed by the remote host>

607 views
Skip to first unread message

Chaitanya Phani

unread,
Jan 24, 2018, 9:35:05 AM1/24/18
to AdWords API Forum
Hi, 

I was facing this issue very frequently. I have 250 advertiser accounts and I need to pull Shopping Performance Report from all the accounts. I was trying to complete this from yesterday but not able to success. I tried to run parallel process downloading which is not working in windows. Looks like there was an issue with one of python libraries and I have raised a ticket for the same. 

Now I am out of options and getting delayed, my downstream applications are waiting on this data. Please help me how to avoid this error. 

The following code is the one which I am running for all accounts, first getting all advertiser accounts and looping the code. 


def download_Performance_Criteria_Report():
 
for client_customer_id in list(set(account_list)):
   
print client_customer_id
    o2client
= GoogleRefreshTokenClient(adc['client_id'],adc['client_secret'],adc['refresh_token'])
    client
=AdWordsClient(adc['developer_token'],o2client,'OBI',client_customer_id=client_customer_id)
    _fpath
=os.path.join('D:/adwords/temp/Adwords_Shopping_MMA_'+str(client_customer_id)+'_'+datetime.datetime.now().strftime( "%Y%m%d%H%M") + '.csv')
 
##    client = AdWordsClient.LoadFromStorage('googleads.yaml')
    rep_downloader
= client.GetReportDownloader(version='v201710')
    report
= {
           
'reportName' : 'SHOPPING_PERFORMANCE_REPORT',
           
'dateRangeType' :'CUSTOM_DATE',
           
'reportType': 'SHOPPING_PERFORMANCE_REPORT',
           
'downloadFormat': 'CSV',
           
'selector': {
               
'fields': ['AccountDescriptiveName','AdGroupId','AdGroupName','AggregatorId','Brand','CampaignId','CampaignName','CategoryL1','CategoryL2','CategoryL3','CategoryL4','CategoryL5','CountryCriteriaId','CustomAttribute0','CustomAttribute1','CustomAttribute2','CustomAttribute3','CustomAttribute4','ExternalCustomerId','LanguageCriteriaId','MerchantId','OfferId','ProductTypeL1','ProductTypeL2','ProductTypeL3','ProductTypeL4','ProductTypeL5','StoreId','Date','AverageCpc','Clicks','ConversionRate','Conversions','ConversionValue','Cost','CostPerAllConversion','CostPerConversion','CrossDeviceConversions','Ctr','Impressions'],
               
'dateRange' : { 'min': '20171225' , 'max' : '20171225'}
               
}
           
}
    _f
=open(_fpath,'wb')
    rep_downloader
.DownloadReport(report,output=_f,skip_report_header=False,skip_column_header=False,skip_report_summary=True)


Sreelakshmi Sasidharan (AdWords API Team)

unread,
Jan 24, 2018, 1:59:28 PM1/24/18
to AdWords API Forum
Hi Chaitanya, 

I see that you are already talking to Vincent about this issue. To avoid duplicates please continue the discussion on that thread. 

Thanks,
Sreelakshmi, AdWords API Team

Chaitanya Phani

unread,
Jan 24, 2018, 2:58:25 PM1/24/18
to AdWords API Forum
No I didn't talk with anyone about this.

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Jan 24, 2018, 4:02:56 PM1/24/18
to AdWords API Forum
Hi Chaitanya,

I was referring to this forum post. Sorry for the confusion. If this is the same issue, please continue the discussion on that thread. If this is a different issue, could you share the complete error logs and your client customer id? You could reply privately to the author while sharing the logs. 

Chaitanya Phani

unread,
Jan 24, 2018, 4:32:18 PM1/24/18
to AdWords API Forum
Hi Sreelakshmi,

This is happening intermittent. So I cant give specific client customer id. Very frequently is happening. 

Thanks,
Chaitanya 

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Jan 25, 2018, 10:50:03 AM1/25/18
to AdWords API Forum
Hi Chaitanya, 

Could you please share the complete error log from one of those instances?
Reply all
Reply to author
Forward
0 new messages