frappe / biometric-attendance-sync-tool

A simple tool for syncing Biometric Attendance data with your ERPNext server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

successfully connected but unable to get data from erpnext

MdAlAmin-aol opened this issue · comments

getting the following error:

  File "/home/frappe/frappe-bench/push-biometric-erpnext/venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
    chunked=chunked,
  File "/home/frappe/frappe-bench/push-biometric-erpnext/venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 421, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/home/frappe/frappe-bench/push-biometric-erpnext/venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 416, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.7/http/client.py", line 1344, in getresponse
    response.begin()
  File "/usr/lib/python3.7/http/client.py", line 306, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.7/http/client.py", line 288, in _read_status
    raise BadStatusLine(line)
http.client.BadStatusLine: SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/push-biometric-erpnext/venv/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/home/frappe/frappe-bench/push-biometric-erpnext/venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/home/frappe/frappe-bench/push-biometric-erpnext/venv/lib/python3.7/site-packages/urllib3/util/retry.py", line 400, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/home/frappe/frappe-bench/push-biometric-erpnext/venv/lib/python3.7/site-packages/urllib3/packages/six.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "/home/frappe/frappe-bench/push-biometric-erpnext/venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
    chunked=chunked,
  File "/home/frappe/frappe-bench/push-biometric-erpnext/venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 421, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/home/frappe/frappe-bench/push-biometric-erpnext/venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 416, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.7/http/client.py", line 1344, in getresponse
    response.begin()
  File "/usr/lib/python3.7/http/client.py", line 306, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.7/http/client.py", line 288, in _read_status
    raise BadStatusLine(line)
urllib3.exceptions.ProtocolError: ('Connection aborted.', BadStatusLine('SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3\r\n'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "push_to_erpnext.py", line 49, in main
    pull_process_and_push_data(device, device_attendance_logs)
  File "push_to_erpnext.py", line 106, in pull_process_and_push_data
    erpnext_status_code, erpnext_message = send_to_erpnext(device_attendance_log['user_id'], device_attendance_log['timestamp'], device['device_id'], device['punch_direction'])
  File "push_to_erpnext.py", line 170, in send_to_erpnext
    response = requests.request("POST", url, headers=headers, data=data)
  File "/home/frappe/frappe-bench/push-biometric-erpnext/venv/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/frappe/frappe-bench/push-biometric-erpnext/venv/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/frappe/frappe-bench/push-biometric-erpnext/venv/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/home/frappe/frappe-bench/push-biometric-erpnext/venv/lib/python3.7/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine('SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3\r\n'))

error.log
logs.log

@MdAlAmin-aol , good that you have shared the logs...

I think adding 'https' instead of 'http' for your erpnext instance URL should solve your issue.

https://stackoverflow.com/questions/28557466/python-requests-exception-connectionerror-connection-aborted-badstatusline

thank you for quick respond.can you help me on this please.
error.log

yes , i did. but no result.

@MdAlAmin-aol, you seem to be having an error which we have not seen before and there is insufficient information in the error log to conclude anything... The error logging has now been improved in the latest commit... So, Please pull the latest changes and try again.. You would get a more detailed error log, which should help you solve the issue...

Also, Next time you open an issue, Please paste the error in the Description instead of only uploading the file... this would help other people searching for a similar issue...