コード例 #1
0
ファイル: Downloader.py プロジェクト: eddo888/Spanners
#!/usr/bin/env python3

import os, re, sys, requests, hashlib, shutil, io, urllib3, logging, arrow

from urllib.parse import quote_plus, urlparse
from bs4 import BeautifulSoup as BS

from Baubles.Logger import Logger

logger = Logger()
logger.setLevel(logging.INFO)


# todo: https://stackoverflow.com/questions/22894211/how-to-resume-file-download-in-python

#_____________________________________________________________________________
class Downloader(object):
	'''
	cached download manager
	'''
	
	def __init__(self, cacheDir='.cache', fresh=False, resumable=False):
		#urllib3.disable_warnings()
		self.cacheDir = cacheDir
		self.fresh = fresh
		self.resumable = resumable
		logger.debug('cacheDir='+self.cacheDir)
		

	def download(self, url, file=None, username=None, password=None):
		'''
コード例 #2
0
#!/usr/bin/env python3

# PYTHON_ARGCOMPLETE_OK

import sys, re, os, json, logging, requests, urllib, boto.ec2

from collections import namedtuple

from Baubles.Logger import Logger
from Argumental.Argue import Argue

from CloudyDaze.MyAWS import config, silence

silence()

logger = Logger()
args = Argue()


#_____________________________________________________
@args.command(single=True)
class MySG(object):
    @args.property(short='p', default='default')
    def profile(self):
        return

    @args.property(short='u', default='https://api.ipify.org?format=json')
    def url(self):
        return

    @args.property(short='v', flag=True, help='verbose logging')