pyreposync 0.2.6__py3-none-any.whl → 0.2.7__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.
pyreposync/__init__.py CHANGED
@@ -269,6 +269,12 @@ class PyRepoSync:
269
269
  section, "allow_missing_packages", fallback=False
270
270
  ),
271
271
  treeinfo=self.config.get(section, "treeinfo", fallback=".treeinfo"),
272
+ basic_auth_user=self.config.get(
273
+ section, "basic_auth_user", fallback=None
274
+ ),
275
+ basic_auth_pass=self.config.get(
276
+ section, "basic_auth_pass", fallback=None
277
+ ),
272
278
  proxy=self.config.get("main", "proxy", fallback=None),
273
279
  client_cert=self.config.get(section, "sslclientcert", fallback=None),
274
280
  client_key=self.config.get(section, "sslclientkey", fallback=None),
@@ -283,6 +289,12 @@ class PyRepoSync:
283
289
  allow_missing_packages=self.config.getboolean(
284
290
  section, "allow_missing_packages", fallback=False
285
291
  ),
292
+ basic_auth_user=self.config.get(
293
+ section, "basic_auth_user", fallback=None
294
+ ),
295
+ basic_auth_pass=self.config.get(
296
+ section, "basic_auth_pass", fallback=None
297
+ ),
286
298
  proxy=self.config.get(section, "proxy", fallback=None),
287
299
  client_cert=self.config.get(section, "sslclientcert", fallback=None),
288
300
  client_key=self.config.get(section, "sslclientkey", fallback=None),
@@ -291,6 +303,7 @@ class PyRepoSync:
291
303
  components=self.config.get(section, "components").split(),
292
304
  binary_archs=self.config.get(section, "binary_archs").split(),
293
305
  )
306
+ return None
294
307
 
295
308
  def get_sections(self):
296
309
  sections = set()
pyreposync/downloader.py CHANGED
@@ -2,6 +2,7 @@ import hashlib
2
2
  import logging
3
3
  import os
4
4
  import requests
5
+ import requests.auth
5
6
  import requests.exceptions
6
7
  import shutil
7
8
  import tempfile
@@ -11,8 +12,20 @@ from pyreposync.exceptions import OSRepoSyncDownLoadError, OSRepoSyncHashError
11
12
 
12
13
 
13
14
  class Downloader(object):
14
- def __init__(self, proxy=None, client_cert=None, client_key=None, ca_cert=None):
15
+ def __init__(
16
+ self,
17
+ basic_auth_user=None,
18
+ basic_auth_pass=None,
19
+ proxy=None,
20
+ client_cert=None,
21
+ client_key=None,
22
+ ca_cert=None,
23
+ ):
15
24
  self.log = logging.getLogger("application")
25
+ if basic_auth_user and basic_auth_pass:
26
+ self._basic_auth = (basic_auth_user, basic_auth_pass)
27
+ else:
28
+ self._basic_auth = None
16
29
  if proxy:
17
30
  self._proxy = {"http": proxy, "https": proxy}
18
31
  else:
@@ -26,6 +39,10 @@ class Downloader(object):
26
39
  else:
27
40
  self._ca_cert = True
28
41
 
42
+ @property
43
+ def basic_auth(self):
44
+ return self._basic_auth
45
+
29
46
  @property
30
47
  def ca_cert(self):
31
48
  return self._ca_cert
@@ -123,7 +140,12 @@ class Downloader(object):
123
140
  ):
124
141
  self.create_dir(destination)
125
142
  r = requests.get(
126
- url, stream=True, proxies=self.proxy, cert=self.cert, verify=self.ca_cert
143
+ url,
144
+ auth=self.basic_auth,
145
+ stream=True,
146
+ proxies=self.proxy,
147
+ cert=self.cert,
148
+ verify=self.ca_cert,
127
149
  )
128
150
  if r.status_code == 200:
129
151
  with open(destination, "wb", 0) as dst:
pyreposync/sync_deb822.py CHANGED
@@ -17,6 +17,8 @@ class SyncDeb822(SyncGeneric):
17
17
  components,
18
18
  binary_archs,
19
19
  allow_missing_packages,
20
+ basic_auth_user=None,
21
+ basic_auth_pass=None,
20
22
  proxy=None,
21
23
  client_cert=None,
22
24
  client_key=None,
@@ -28,6 +30,8 @@ class SyncDeb822(SyncGeneric):
28
30
  reponame=reponame,
29
31
  date=date,
30
32
  allow_missing_packages=allow_missing_packages,
33
+ basic_auth_user=basic_auth_user,
34
+ basic_auth_pass=basic_auth_pass,
31
35
  proxy=proxy,
32
36
  client_cert=client_cert,
33
37
  client_key=client_key,
@@ -14,6 +14,8 @@ class SyncGeneric:
14
14
  reponame,
15
15
  date,
16
16
  allow_missing_packages,
17
+ basic_auth_user=None,
18
+ basic_auth_pass=None,
17
19
  proxy=None,
18
20
  client_cert=None,
19
21
  client_key=None,
@@ -25,7 +27,12 @@ class SyncGeneric:
25
27
  self._destination = destination
26
28
  self._reponame = reponame
27
29
  self.downloader = Downloader(
28
- proxy=proxy, client_cert=client_cert, client_key=client_key, ca_cert=ca_cert
30
+ basic_auth_user=basic_auth_user,
31
+ basic_auth_pass=basic_auth_pass,
32
+ proxy=proxy,
33
+ client_cert=client_cert,
34
+ client_key=client_key,
35
+ ca_cert=ca_cert,
29
36
  )
30
37
  self.log = logging.getLogger("application")
31
38
 
pyreposync/sync_rpm.py CHANGED
@@ -24,6 +24,8 @@ class SyncRPM(SyncGeneric):
24
24
  date,
25
25
  treeinfo,
26
26
  allow_missing_packages,
27
+ basic_auth_user=None,
28
+ basic_auth_pass=None,
27
29
  proxy=None,
28
30
  client_cert=None,
29
31
  client_key=None,
@@ -35,6 +37,8 @@ class SyncRPM(SyncGeneric):
35
37
  reponame=reponame,
36
38
  date=date,
37
39
  allow_missing_packages=allow_missing_packages,
40
+ basic_auth_user=basic_auth_user,
41
+ basic_auth_pass=basic_auth_pass,
38
42
  proxy=proxy,
39
43
  client_cert=client_cert,
40
44
  client_key=client_key,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyreposync
3
- Version: 0.2.6
3
+ Version: 0.2.7
4
4
  Summary: rpm and deb822 repository sync tool
5
5
  Project-URL: Source, https://github.com/schlitzered/pyreposync
6
6
  Author-email: "Stephan.Schultchen" <sschultchen@gmail.com>
@@ -0,0 +1,11 @@
1
+ pyreposync/__init__.py,sha256=fHirsBBkEk806RJwVKQZHgujQZRk13YnokX-8rp_QJE,17117
2
+ pyreposync/downloader.py,sha256=cRUtbQ4PYbGDczZl5PsBtTQFhqagnX9IQvbwSCd0OBc,5212
3
+ pyreposync/exceptions.py,sha256=IlnvhNaffQQ6geOgrjCciNFVbFpNcycH4ijSuMTbrGA,169
4
+ pyreposync/sync_deb822.py,sha256=Ynwok1fiZktO3P_0lYWfBOHgaJOFpzfVNkhgKL5Y56s,8517
5
+ pyreposync/sync_generic.py,sha256=qe-ERp8O2kCnhOuToSZWhdQzGY7aYb7G7nUxuKD3lxY,5880
6
+ pyreposync/sync_rpm.py,sha256=FXWEJd2YelMsZeTOnjcNjkN2D_ECtX9HEp73GpiLeK4,11763
7
+ pyreposync-0.2.7.dist-info/METADATA,sha256=t_2vG9j5arm-bG1SyZ0DDqADLwQKEiqS66EZ-q1VnJE,1591
8
+ pyreposync-0.2.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
+ pyreposync-0.2.7.dist-info/entry_points.txt,sha256=9LsBDWOF3O6_3ONP3Lc-4v1MTt5ay0Xv-TMcFbOIt2s,47
10
+ pyreposync-0.2.7.dist-info/licenses/LICENSE.txt,sha256=lwnJoIo7uwc0h6y6gC_RYqJkvjplViV3Ad6u7pQM4Bw,1084
11
+ pyreposync-0.2.7.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- pyreposync/__init__.py,sha256=hhsb3ZqssxKAcSZ_rEiG_2XjgbRK1SveMtL_sI9pMnI,16577
2
- pyreposync/downloader.py,sha256=828bIMCctd1X6I1w91-XHytQ1M5fmxkEw0YDKd5nvAY,4764
3
- pyreposync/exceptions.py,sha256=IlnvhNaffQQ6geOgrjCciNFVbFpNcycH4ijSuMTbrGA,169
4
- pyreposync/sync_deb822.py,sha256=XkIZfYfgshYFwdk1oL8TsysUge2_6iPiz5zOmKNaZRk,8367
5
- pyreposync/sync_generic.py,sha256=wN5hPcIacvQiMQoajcf7WSbiBGqxI86CYwfVnq1fR38,5693
6
- pyreposync/sync_rpm.py,sha256=1yf2-lQShKyY3CI_FW1i0tyWQ0sg69iBUn-4iWfoevk,11613
7
- pyreposync-0.2.6.dist-info/METADATA,sha256=_iKcUStZxLy2goNOQgaIMgRE3CzmG34iDz-nXKN51Jw,1591
8
- pyreposync-0.2.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
- pyreposync-0.2.6.dist-info/entry_points.txt,sha256=9LsBDWOF3O6_3ONP3Lc-4v1MTt5ay0Xv-TMcFbOIt2s,47
10
- pyreposync-0.2.6.dist-info/licenses/LICENSE.txt,sha256=lwnJoIo7uwc0h6y6gC_RYqJkvjplViV3Ad6u7pQM4Bw,1084
11
- pyreposync-0.2.6.dist-info/RECORD,,