huvrdata / huvr-client

HUVR client
BSD 2-Clause "Simplified" License
5 stars 1 forks source link

Fix python 2 to 3 compatibility issue #1

Closed jsheffie closed 11 months ago

jsheffie commented 4 years ago

When downloading and writing json we get the following error.

Processing project_id: 507 of total: 507 for ProjectType: Main_Bearing
huvr_client: Fetching https://demo.huvrdatacloud.com/api/projects/6744040177401856/defects
huvr_client: Fetched GET https://demo.huvrdatacloud.com/api/projects/6744040177401856/defects
huvr_client: Fetching https://demo.huvrdatacloud.com/api/projects_meta/6744040177401856
huvr_client: Fetched GET https://demo.huvrdatacloud.com/api/projects_meta/6744040177401856
Project: 6744040177401856 has checklist_id: 6426970726334464
huvr_client: Fetching https://demo.huvrdatacloud.com/api/v2/checklist/6426970726334464
huvr_client: Fetched GET https://demo.huvrdatacloud.com/api/v2/checklist/6426970726334464
Traceback (most recent call last):
  File "c:/Users/elvis/OneDrive for Business/Sync/Desktop/download_defects.py", line 165, in <module>
    write_json_file(filename, final_defects)
  File "C:\Users\elvis\AppData\Local\Programs\Python\Python38-32\lib\site-packages\huvr_client\helpers.py", line 28, in write_json_file
    outfile.write(json.dumps(data, indent=4))
TypeError: a bytes-like object is required, not 'str'