This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import json | |
import os | |
import sys | |
import traceback | |
import urllib.request | |
from collections import defaultdict, Counter | |
from datetime import datetime | |
from itertools import chain | |
from time import gmtime, strftime, sleep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ /usr/bin/time -v python3 requests_text.py 1 | |
Command being timed: "python3 requests_text.py 1" | |
User time (seconds): 0.15 | |
System time (seconds): 0.02 | |
Percent of CPU this job got: 11% | |
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:01.60 | |
Average shared text size (kbytes): 0 | |
Average unshared data size (kbytes): 0 | |
Average stack size (kbytes): 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
/usr/bin/time -v python3 json_loads.py | |
/usr/bin/time -v python3 requests_json.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from multiprocessing.pool import ThreadPool | |
from bs4 import BeautifulSoup | |
from urllib.request import urlopen | |
import requests | |
soup = BeautifulSoup(urlopen("http://www.oxfordjournals.org/nar/database/a"), "lxml") | |
urls = [link['href'] for link in soup.find_all('a', href=True) if link.text.strip() == "database"] | |
total = len(urls) | |
failed = 0 |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.