Allow guest connection in FrappeClient

This commit is contained in:
Faris Ansari 2018-07-31 18:27:05 +05:30
parent 854b068ee9
commit 0e40b18ecc
2 changed files with 5 additions and 3 deletions

View file

@ -138,7 +138,6 @@ class DataMigrationRun(Document):
if postprocess_method_path:
frappe.get_attr(postprocess_method_path)({
"status": status,
"remote_id": self.remote_id or '',
"stats": {
"push_insert": self.push_insert,
"push_update": self.push_update,

View file

@ -15,12 +15,15 @@ class FrappeException(Exception):
pass
class FrappeClient(object):
def __init__(self, url, username, password, verify=True):
def __init__(self, url, username=None, password=None, verify=True):
self.headers = dict(Accept='application/json')
self.verify = verify
self.session = requests.session()
self.url = url
self._login(username, password)
# for guest connection
if username:
self._login(username, password)
def __enter__(self):
return self