|
1 | 1 | #!/usr/bin/env python |
2 | 2 |
|
3 | 3 | from __future__ import print_function |
4 | | -import socket |
5 | 4 |
|
6 | 5 | import argparse |
7 | 6 | import base64 |
|
10 | 9 | import errno |
11 | 10 | import getpass |
12 | 11 | import json |
| 12 | +import logging |
13 | 13 | import os |
| 14 | +import platform |
14 | 15 | import re |
15 | 16 | import select |
| 17 | +import socket |
16 | 18 | import subprocess |
17 | 19 | import sys |
18 | | -import logging |
19 | 20 | import time |
20 | | -import platform |
21 | | -from urllib.parse import urlparse |
22 | | -from urllib.parse import quote as urlquote |
23 | | -from urllib.parse import urlencode |
24 | | -from urllib.error import HTTPError, URLError |
25 | | -from urllib.request import urlopen |
26 | | -from urllib.request import Request |
27 | | -from urllib.request import HTTPRedirectHandler |
28 | | -from urllib.request import build_opener |
29 | 21 | from http.client import IncompleteRead |
| 22 | +from urllib.error import HTTPError, URLError |
| 23 | +from urllib.parse import quote as urlquote |
| 24 | +from urllib.parse import urlencode, urlparse |
| 25 | +from urllib.request import HTTPRedirectHandler, Request, build_opener, urlopen |
30 | 26 |
|
31 | 27 | try: |
32 | 28 | from . import __version__ |
|
41 | 37 |
|
42 | 38 |
|
43 | 39 | def logging_subprocess( |
44 | | - popenargs, |
45 | | - stdout_log_level=logging.DEBUG, |
46 | | - stderr_log_level=logging.ERROR, |
47 | | - **kwargs |
| 40 | + popenargs, stdout_log_level=logging.DEBUG, stderr_log_level=logging.ERROR, **kwargs |
48 | 41 | ): |
49 | 42 | """ |
50 | 43 | Variant of subprocess.call that accepts a logger instead of stdout/stderr, |
@@ -626,12 +619,12 @@ def retrieve_data_gen(args, template, query_args=None, single_request=False): |
626 | 619 | raise Exception(", ".join(errors)) |
627 | 620 |
|
628 | 621 | if len(errors) == 0: |
629 | | - if type(response) == list: |
| 622 | + if type(response) is list: |
630 | 623 | for resp in response: |
631 | 624 | yield resp |
632 | 625 | if len(response) < per_page: |
633 | 626 | break |
634 | | - elif type(response) == dict and single_request: |
| 627 | + elif type(response) is dict and single_request: |
635 | 628 | yield response |
636 | 629 |
|
637 | 630 | if len(errors) > 0: |
|
0 commit comments