nc-py-api 0.18.0__py3-none-any.whl → 0.18.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
nc_py_api/_session.py CHANGED
@@ -12,6 +12,7 @@ from json import loads
12
12
  from os import environ
13
13
 
14
14
  from httpx import AsyncClient, Client, Headers, Limits, ReadTimeout, Request, Response
15
+ from httpx import __version__ as httpx_version
15
16
  from starlette.requests import HTTPConnection
16
17
 
17
18
  from . import options
@@ -511,6 +512,7 @@ class NcSessionApp(NcSessionAppBasic, NcSessionBasic):
511
512
  "AA-VERSION": self.cfg.aa_version,
512
513
  "EX-APP-ID": self.cfg.app_name,
513
514
  "EX-APP-VERSION": self.cfg.app_version,
515
+ "user-agent": f"ExApp/{self.cfg.app_name}/{self.cfg.app_version} (httpx/{httpx_version})",
514
516
  },
515
517
  )
516
518
 
@@ -535,6 +537,7 @@ class AsyncNcSessionApp(NcSessionAppBasic, AsyncNcSessionBasic):
535
537
  "AA-VERSION": self.cfg.aa_version,
536
538
  "EX-APP-ID": self.cfg.app_name,
537
539
  "EX-APP-VERSION": self.cfg.app_version,
540
+ "User-Agent": f"ExApp/{self.cfg.app_name}/{self.cfg.app_version} (httpx/{httpx_version})",
538
541
  },
539
542
  )
540
543
 
nc_py_api/_version.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """Version of nc_py_api."""
2
2
 
3
- __version__ = "0.18.0"
3
+ __version__ = "0.18.2"
nc_py_api/ex_app/misc.py CHANGED
@@ -33,7 +33,7 @@ def verify_version(finalize_update: bool = True) -> tuple[str, str] | None:
33
33
  """
34
34
  version_file_path = os.path.join(persistent_storage(), "_version.info")
35
35
  r = None
36
- with open(version_file_path, "a+t", encoding="UTF-8") as version_file:
36
+ with open(version_file_path, "a+", encoding="UTF-8") as version_file:
37
37
  version_file.seek(0)
38
38
  old_version = version_file.read()
39
39
  if old_version != os.environ["APP_VERSION"]:
nc_py_api/files/files.py CHANGED
@@ -485,7 +485,8 @@ class FilesAPI:
485
485
  response = self._session.adapter_dav.request("MKCOL", _dav_path)
486
486
  check_error(response)
487
487
  try:
488
- start_bytes = end_bytes = chunk_number = 0
488
+ start_bytes = end_bytes = 0
489
+ chunk_number = 1
489
490
  while True:
490
491
  piece = fp.read(chunk_size)
491
492
  if not piece:
nc_py_api/options.py CHANGED
@@ -33,11 +33,22 @@ NPA_NC_CERT: bool | str
33
33
  SSL certificates (a.k.a CA bundle) used to verify the identity of requested hosts. Either **True** (default CA bundle),
34
34
  a path to an SSL certificate file, or **False** (which will disable verification)."""
35
35
  str_val = environ.get("NPA_NC_CERT", "True")
36
- NPA_NC_CERT = True
36
+ # https://github.com/encode/httpx/issues/302
37
+ # when "httpx" will switch to use "truststore" by default - uncomment next line
38
+ # NPA_NC_CERT = True
37
39
  if str_val.lower() in ("false", "0"):
38
40
  NPA_NC_CERT = False
39
41
  elif str_val.lower() not in ("true", "1"):
40
42
  NPA_NC_CERT = str_val
43
+ else:
44
+ # Temporary workaround, see comment above.
45
+ # Use system certificate stores
46
+
47
+ import ssl
48
+
49
+ import truststore
50
+
51
+ NPA_NC_CERT = truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
41
52
 
42
53
  CHUNKED_UPLOAD_V2 = environ.get("CHUNKED_UPLOAD_V2", True)
43
54
  """Option to enable/disable **version 2** chunked upload(better Object Storages support).
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: nc-py-api
3
- Version: 0.18.0
3
+ Version: 0.18.2
4
4
  Summary: Nextcloud Python Framework
5
5
  Project-URL: Changelog, https://github.com/cloud-py-api/nc_py_api/blob/main/CHANGELOG.md
6
6
  Project-URL: Documentation, https://cloud-py-api.github.io/nc_py_api/
@@ -20,6 +20,7 @@ Classifier: Programming Language :: Python :: 3 :: Only
20
20
  Classifier: Programming Language :: Python :: 3.10
21
21
  Classifier: Programming Language :: Python :: 3.11
22
22
  Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
23
24
  Classifier: Programming Language :: Python :: Implementation :: CPython
24
25
  Classifier: Programming Language :: Python :: Implementation :: PyPy
25
26
  Classifier: Topic :: Internet :: WWW/HTTP
@@ -33,6 +34,7 @@ Requires-Dist: fastapi>=0.109.2
33
34
  Requires-Dist: httpx>=0.25.2
34
35
  Requires-Dist: pydantic>=2.1.1
35
36
  Requires-Dist: python-dotenv>=1
37
+ Requires-Dist: truststore==0.10
36
38
  Requires-Dist: xmltodict>=0.13
37
39
  Provides-Extra: app
38
40
  Requires-Dist: uvicorn[standard]>=0.23.2; extra == 'app'
@@ -4,10 +4,10 @@ nc_py_api/_exceptions.py,sha256=7vbUECaLmD7RJBCU27t4fuP6NmQK6r4508u_gS4szhI,2298
4
4
  nc_py_api/_misc.py,sha256=dUzCP9VmyhtICTsn1aexlFAYUioBm40k6Zh-YE5WwCY,3333
5
5
  nc_py_api/_preferences.py,sha256=OtovFZuGHnHYKjdDjSnUappO795tW8Oxj7qVaejHWpQ,2479
6
6
  nc_py_api/_preferences_ex.py,sha256=tThj6U0ZZMaBZ-jUkjrbaI0xDnafWsBowQKsC6gjOQs,7179
7
- nc_py_api/_session.py,sha256=ZD0TKrL-tOpxYtV6AO0cwRrYzbnjBr_ylCEUirrykjU,20242
7
+ nc_py_api/_session.py,sha256=h5S-Zd26tkq7-FxJ1mqJaa9YoNzVRIN2CkUBBNAAjJo,20503
8
8
  nc_py_api/_talk_api.py,sha256=0Uo7OduYniuuX3UQPb468RyGJJ-PWBCgJ5HoPuz5Qa0,51068
9
9
  nc_py_api/_theming.py,sha256=hTr3nuOemSuRFZaPy9iXNmBM7rDgQHECH43tHMWGqEY,1870
10
- nc_py_api/_version.py,sha256=t3qny54XTwpi3rVJqMS8yB4HNF5ZcqFIKiy_TGER6lQ,52
10
+ nc_py_api/_version.py,sha256=hLV4fonCqbhDftVE3lJ1pszd3t3jAjpr4Lt4JQhlFUg,52
11
11
  nc_py_api/activity.py,sha256=t9VDSnnaXRNOvALqOSGCeXSQZ-426pCOMSfQ96JHys4,9574
12
12
  nc_py_api/apps.py,sha256=Us2y2lszdxXlD8t6kxwd5_Nrrmazc0EvZXIH9O-ol80,9315
13
13
  nc_py_api/calendar.py,sha256=-T6CJ8cRbJZTLtxSEDWuuYpD29DMJGCTfLONmtxZV9w,1445
@@ -15,7 +15,7 @@ nc_py_api/loginflow_v2.py,sha256=UjkK3gMouzNrIS7BFhjbmB_9m4fP2UY5sfpmvJ2EXWk,576
15
15
  nc_py_api/nextcloud.py,sha256=Uc4hOtLNkvl8sjKmAGS-vyKdiA1gEZwRr1wj0Sd_ONk,23005
16
16
  nc_py_api/notes.py,sha256=ljO3TOe-Qg0bJ0mlFQwjg--Pxmj-XFknoLbcbJmII0A,15106
17
17
  nc_py_api/notifications.py,sha256=WgzV21TuLOhLk-UEjhBSbMsIi2isa5MmAx6cbe0pc2Y,9187
18
- nc_py_api/options.py,sha256=K5co-fIfFVbwF6r3sqWsJF3cKgAbS2CjLAXdyTOkP9s,1717
18
+ nc_py_api/options.py,sha256=ZKJqVLhWVwJ6YxAKzGWlPXJhd1vg9GluyFzr-jX4Jp0,2038
19
19
  nc_py_api/talk.py,sha256=OZFemYkDOaM6o4xAK3EvQbjMFiK75E5qnsCDyihIElg,29368
20
20
  nc_py_api/talk_bot.py,sha256=_RuImwb3jYvUKX3ywcX095ucOjECCxsuc59heIxNoTM,16725
21
21
  nc_py_api/user_status.py,sha256=I101nwYS8X1WvC8AnLa2f3qJUCPDPHrbq-ke0h1VT4E,13282
@@ -28,7 +28,7 @@ nc_py_api/ex_app/defs.py,sha256=FaQInH3jLugKxDUqpwrXdkMT-lBxmoqWmXJXc11fa6A,727
28
28
  nc_py_api/ex_app/events_listener.py,sha256=pgQ4hSQV39NuP9F9IDWxo0Qle6oG15-Ol2FlItnIBGY,4682
29
29
  nc_py_api/ex_app/integration_fastapi.py,sha256=xh-gSxYH6_FE8GluajlrVAHZg1HZeaAxJ-jIUP6uot4,11022
30
30
  nc_py_api/ex_app/logging.py,sha256=nAHLObuPvl3UBLrlqZulgoxxVaAJ661iP4F6bTW-V-Y,1475
31
- nc_py_api/ex_app/misc.py,sha256=76EP7Ui3yEMZE3AP3-1Cc_buGDLSAurn8PDig6RN6QQ,2299
31
+ nc_py_api/ex_app/misc.py,sha256=c7B0uE8isaIi4SQbxURGUuWjZaaXiLg3Ov6cqvRYplE,2298
32
32
  nc_py_api/ex_app/occ_commands.py,sha256=hb2BJuvFKIigvLycSCyAe9v6hedq4Gfu2junQZTaK_M,5219
33
33
  nc_py_api/ex_app/persist_transformers_cache.py,sha256=ZoEBb1RnNaQrtxK_CjSZ8LZ36Oakz2Xciau_ZpNp8Ic,213
34
34
  nc_py_api/ex_app/uvicorn_fastapi.py,sha256=WLtNmWXMBKN6CMip2uhKcgy4mC2Ch9AmNfwRScBUsP0,752
@@ -43,11 +43,11 @@ nc_py_api/ex_app/ui/top_menu.py,sha256=oCgGtIoMYbp-5iN5aXEbT7Q88HtccR7hg6IBFgbby
43
43
  nc_py_api/ex_app/ui/ui.py,sha256=OqFHKn6oIZli8T1wnv6YtQ4glNfeNb90WwGCvtWI1Z4,1632
44
44
  nc_py_api/files/__init__.py,sha256=uSjqZyYAq9x3xOb_yz15KNNAcPo1PhbpPLtPz_ej-Eo,17303
45
45
  nc_py_api/files/_files.py,sha256=_s_f8xbzQPEH2F2LNwomI9CxscYHryus1pMZ_vW00C4,13666
46
- nc_py_api/files/files.py,sha256=6G4zONjnI7oSCUf4C79xrFV4QUYquxZDCLlpkGvME0M,24912
46
+ nc_py_api/files/files.py,sha256=7x4hfnVa2y1R5bxK9f8cdggi1gPnpUYnsBj0e4p-4qc,24926
47
47
  nc_py_api/files/files_async.py,sha256=nyDeWiGx_8CHuVrNThSgfZy0l-WlC4El-TzJONo0TsM,25773
48
48
  nc_py_api/files/sharing.py,sha256=VRZCl-TYK6dbu9rUHPs3_jcVozu1EO8bLGZwoRpiLsU,14439
49
- nc_py_api-0.18.0.dist-info/METADATA,sha256=_cUiEBjdiSBuqx6RM9HyIMR_pjr62TanPtBpb9DFmlw,9451
50
- nc_py_api-0.18.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
51
- nc_py_api-0.18.0.dist-info/licenses/AUTHORS,sha256=B2Q9q9XH3PAxJp0V3GiKQc1l0z7vtGDpDHqda-ISWKM,616
52
- nc_py_api-0.18.0.dist-info/licenses/LICENSE.txt,sha256=OLEMh401fAumGHfRSna365MLIfnjdTcdOHZ6QOzMjkg,1551
53
- nc_py_api-0.18.0.dist-info/RECORD,,
49
+ nc_py_api-0.18.2.dist-info/METADATA,sha256=w6waXTKQimSLZrNeCDd7Gpy12U0fK6SlYFEVgpMxHX4,9534
50
+ nc_py_api-0.18.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
51
+ nc_py_api-0.18.2.dist-info/licenses/AUTHORS,sha256=B2Q9q9XH3PAxJp0V3GiKQc1l0z7vtGDpDHqda-ISWKM,616
52
+ nc_py_api-0.18.2.dist-info/licenses/LICENSE.txt,sha256=OLEMh401fAumGHfRSna365MLIfnjdTcdOHZ6QOzMjkg,1551
53
+ nc_py_api-0.18.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.25.0
2
+ Generator: hatchling 1.27.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any