ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

FrappeClient - Connection refused after large number of queries

bug
erpnext

#1

Hi specialists ;-))

I try to update a large number of Accounts with german account number (SKR04) from a csv file

After updating some - especially account with longer names - after some updates I get at first an error BadStatusLine, second an error HTTPConnectionPool(host=‘192.168.0.25’, port=80): Max retries exceeded with url: /?cmd=frappe.client.get_value&fieldname=name&doctype=Account&filters=%7B%22name%22%3A+%22Aufzuteilende+Vorsteuer+7%25±+OBH%22%7D (Caused by NewConnectionError(’<urllib3.connection.HTTPConnection object at 0x00000000044AD6D8>: Failed to establish a new connection: [Errno 10060]

Code

name = client.get_value(“Account”,“name”,{“name”:acctext})
number = client.get_value(“Account”,“account_number”,{“name”:acctext})
reptype = client.get_value(“Account”,“report_type”,{“name”:acctext})
if name:
if number[“account_number”] == “”:
doc = client.get_doc(‘Account’,name[“name”])
doc[“account_number”] = Konto
client.update(doc)

Mostly after this it is impossible to connect any further connection. I’ve tried allready to close the Connection after every 10 Updates. Still the same error.

Has anybody any idea ?

Thanks


#2

Does it work for a single update (account with longer names) ? There is a bulk update you could try.

def bulk_update(self, docs):
		'''Bulk update documents remotely

		:param docs: List of dict or Document objects to be updated remotely (by `name`)'''
		return self.post_request({
			"cmd": "frappe.client.bulk_update",
			"docs": frappe.as_json(docs)
		})