[nix] fix the auth error

This commit is contained in:
dramforever 2020-03-24 19:28:50 +08:00 committed by root
parent b35e023132
commit 04dc6f63f6
2 changed files with 8 additions and 2 deletions

View File

@ -16,6 +16,8 @@ from datetime import datetime, timedelta
from pathlib import Path from pathlib import Path
from concurrent.futures import ThreadPoolExecutor from concurrent.futures import ThreadPoolExecutor
from minio.credentials import Credentials, Static
from urllib3.util.retry import Retry from urllib3.util.retry import Retry
### Config ### Config
@ -135,7 +137,8 @@ def download(url, dest):
download_dest.rename(dest) download_dest.rename(dest)
client = minio.Minio('s3.amazonaws.com') credentials = Credentials(provider=Static())
client = minio.Minio('s3.amazonaws.com', credentials=credentials)
def get_channels(): def get_channels():
return [ return [

View File

@ -14,6 +14,8 @@ from datetime import datetime, timedelta
from pathlib import Path from pathlib import Path
from collections import defaultdict from collections import defaultdict
from minio.credentials import Credentials, Static
from urllib3.util.retry import Retry from urllib3.util.retry import Retry
UPSTREAM_URL = os.getenv('TUNASYNC_UPSTREAM_URL', 'https://nixos.org/channels') UPSTREAM_URL = os.getenv('TUNASYNC_UPSTREAM_URL', 'https://nixos.org/channels')
@ -89,7 +91,8 @@ def download(url, dest):
download_dest.rename(dest) download_dest.rename(dest)
client = minio.Minio('s3.amazonaws.com') credentials = Credentials(provider=Static())
client = minio.Minio('s3.amazonaws.com', credentials=credentials)
def get_url(name): def get_url(name):
response = client.get_object('nix-channels', name) response = client.get_object('nix-channels', name)