Skip to content

Commit 6f736ed

Browse files
committed
ref: add timeout for icon dl and don't force logging style on other libs
1 parent fab5c95 commit 6f736ed

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

dcoraid/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
# flake8: noqa: F401
2-
import logging
3-
42
from . import api, dbmodel, download, upload
53
from .api import CKANAPI
64
from .dbmodel import APIInterrogator
75
from .upload.task import create_task
86
from ._version import version as __version__
9-
10-
logging.basicConfig(
11-
level=logging.INFO,
12-
format="%(asctime)s %(levelname)s %(processName)s/%(threadName)s "
13-
+ "in %(name)s: %(message)s",
14-
datefmt='%H:%M:%S')

dcoraid/__main__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
def main(splash=True):
2+
import logging
23
import os
34
import pkg_resources
45
import platform
56
import sys
67

8+
logging.basicConfig(
9+
level=logging.INFO,
10+
format="%(asctime)s %(levelname)s %(processName)s/%(threadName)s "
11+
+ "in %(name)s: %(message)s",
12+
datefmt='%H:%M:%S')
13+
714
from PyQt5.QtWidgets import QApplication
815

916
if platform.win32_ver()[0] == "7":

dcoraid/cli.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import argparse
22
from argparse import RawTextHelpFormatter
3+
import logging
34
import pathlib
45
import threading
56
import time
@@ -100,6 +101,12 @@ def upload_task(path_task=None, server=None, api_key=None, ret_job=False):
100101

101102

102103
def upload_task_parser():
104+
logging.basicConfig(
105+
level=logging.INFO,
106+
format="%(asctime)s %(levelname)s %(processName)s/%(threadName)s "
107+
+ "in %(name)s: %(message)s",
108+
datefmt='%H:%M:%S')
109+
103110
descr = (
104111
"Upload a .dcoraid-task file to a DCOR instance. Example usage::\n"
105112
+ "\n dcoraid-upload-task upload_job.dcoraid-task "

dcoraid/img/icon-theme/collect_icons.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def find_icons(name, theme):
129129
for topic in web_roots[theme]:
130130
filename = name + ".svg"
131131
url = web_roots[theme][topic]
132-
response = requests.get(url + filename)
132+
response = requests.get(url + filename, timeout=3.05)
133133
topic_dir = tmpdir / theme / topic
134134
topic_dir.mkdir(exist_ok=True, parents=True)
135135
if response.status_code == 200:

0 commit comments

Comments
 (0)