nithinmurali / pygsheets

Google Sheets Python API v4
https://pygsheets.readthedocs.io/en/latest
Other
1.51k stars 220 forks source link

Fix multithreading. Fix #291 - SSLError #580

Closed felipemaion closed 1 year ago

felipemaion commented 1 year ago

@nithinmurali I was not able to write the code for the tests, since it was difficult to reproduce the error while multithreading (SSLError). It is working like a charm in my application and all tests passed. The fix is based on the Google APIs page regarding the threading problem with httplib2

felipemaion commented 1 year ago

@nithinmurali another thing for the future due to deprecating (from pytest report):

=============================================================================================== warnings summary ================================================================================================
tests/authorization_test.py::TestAuthorization::test_deprecated_kwargs_removal
tests/authorization_test.py::TestAuthorization::test_kwargs_passed_to_client
 /pygsheets/pygsheets/authorization.py:129: DeprecationWarning: The argument service_file is deprecated. Use service_account_file instead.
    warnings.warn('The argument {} is deprecated. Use {} instead.'.format(key, _deprecated_keyword_mapping[key])

tests/online_test.py::TestClient::test_open_title
  /pygsheets/tests/online_test.py:32: DeprecationWarning: This method will be removed in Python 3.12. Use 'parser.read_file()' instead.
    config.readfp(open(filename))

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================== 71 passed, 3 warnings in 200.91s (0:03:20) ===================================================================================
(
felipemaion commented 1 year ago

@nithinmurali please review the new push request. Thank you

felipemaion commented 1 year ago

@nithinmurali It was showing here tests error with Python 3.7. I just created an env with python=3.7 and run the pytest. Everything passed.

nithinmurali commented 1 year ago

@felipemaion I think it should be fine. The online test can be flaky as it tests against real API. sometimes connection problems can arise.