(args)
| 261 | return [{'url': site, 'timeout': args.timeout} for site in args.sites] |
| 262 | |
| 263 | def do_run(args): |
| 264 | sites = read_sites(args) |
| 265 | replay_server = start_replay_server(args, sites) if args.replay_wpr else None |
| 266 | # Disambiguate domains, if needed. |
| 267 | L = [] |
| 268 | domains = {} |
| 269 | for item in sites: |
| 270 | site = item['url'] |
| 271 | domain = None |
| 272 | if args.domain: |
| 273 | domain = args.domain |
| 274 | elif 'domain' in item: |
| 275 | domain = item['domain'] |
| 276 | else: |
| 277 | m = re.match(r'^(https?://)?([^/]+)(/.*)?$', site) |
| 278 | if not m: |
| 279 | args.error("Invalid URL {}.".format(site)) |
| 280 | continue |
| 281 | domain = m.group(2) |
| 282 | entry = [site, domain, None, item['timeout']] |
| 283 | if domain not in domains: |
| 284 | domains[domain] = entry |
| 285 | else: |
| 286 | if not isinstance(domains[domain], int): |
| 287 | domains[domain][2] = 1 |
| 288 | domains[domain] = 1 |
| 289 | domains[domain] += 1 |
| 290 | entry[2] = domains[domain] |
| 291 | L.append(entry) |
| 292 | try: |
| 293 | # Run them. |
| 294 | for site, domain, count, timeout in L: |
| 295 | if count is not None: domain = "{}%{}".format(domain, count) |
| 296 | print((site, domain, timeout)) |
| 297 | run_site(site, domain, args, timeout) |
| 298 | finally: |
| 299 | if replay_server: |
| 300 | stop_replay_server(replay_server) |
| 301 | |
| 302 | |
| 303 | def do_run_replay_server(args): |
nothing calls this directly
no test coverage detected