Skip to content

Clean-up/Refactoring of old code #177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Dec 12, 2023
Merged

Clean-up/Refactoring of old code #177

merged 15 commits into from
Dec 12, 2023

Conversation

bigcat88
Copy link
Member

@bigcat88 bigcat88 commented Dec 10, 2023

Because initially the project was written for a different AppAPI authentication, where all transmitted data was signed - there was a lot of unnecessary code left.

This pull request will cover it all, total refactoring and simplification of the code.

After this, it will be possible to make public methods for communicating with Nextcloud, which would make it easier to connect third-party packages.

It is also necessary to clean up the code before adding asynchronous methods.

Changes proposed in this pull request:

  • set AUTHORIZATION-APP-API header with help of event_hook
  • set default timeout during httpx.adapter creation
  • set base_url during httpx.adapter creation
  • download_directory_as_zip: directly call session.adapter.stream (removed _session.get_stream)
  • all DAV methods now directly call _session.adapter_dav.XXX (removed _session.dav / _session.dav_stream)
  • removed _session.request and _sessions.request_json - instead directly call session.adapter
  • response_headers are now set with help of httpx.event_hooks
  • other internal code refactoring

Copy link

codecov bot commented Dec 10, 2023

Codecov Report

Merging #177 (418f7c1) into main (695b5a5) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #177      +/-   ##
==========================================
+ Coverage   99.81%   99.84%   +0.02%     
==========================================
  Files          36       36              
  Lines        3330     3277      -53     
==========================================
- Hits         3324     3272      -52     
+ Misses          6        5       -1     
Files Coverage Δ
nc_py_api/_exceptions.py 100.00% <100.00%> (ø)
nc_py_api/_preferences.py 100.00% <100.00%> (ø)
nc_py_api/_preferences_ex.py 100.00% <100.00%> (ø)
nc_py_api/_session.py 99.13% <100.00%> (+0.15%) ⬆️
nc_py_api/_talk_api.py 100.00% <100.00%> (ø)
nc_py_api/activity.py 100.00% <100.00%> (ø)
nc_py_api/apps.py 100.00% <100.00%> (ø)
nc_py_api/calendar.py 100.00% <100.00%> (ø)
nc_py_api/ex_app/ui/files_actions.py 100.00% <100.00%> (ø)
nc_py_api/ex_app/ui/resources.py 100.00% <100.00%> (ø)
... and 10 more

Signed-off-by: Alexander Piskun <[email protected]>
…rs" in httpx.event_hooks

Signed-off-by: Alexander Piskun <[email protected]>
Signed-off-by: Alexander Piskun <[email protected]>
Signed-off-by: Alexander Piskun <[email protected]>
Signed-off-by: Alexander Piskun <[email protected]>
@bigcat88 bigcat88 merged commit 3a01c16 into main Dec 12, 2023
@bigcat88 bigcat88 deleted the clean-up branch December 12, 2023 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant