Пример #1
0
from client import ClientManager, Request

client = ClientManager()

kernel_archive_readme = Request(
    source = "ftp://ftp.kernel.org/",
    ftp_cwd="/pub/",
    username = "",
    password = "",
    # File Pattern is a REGEX
    ftp_file_pattern = "^README$",
    ftp_output_dir = "/tmp/ftp_downloads",
)    

kernel_manpages = Request ( 
    source = "ftp://ftp.kernel.org/",
    ftp_cwd="/pub/linux/docs/man-pages/",
    username = '',
    password = '',
    # File Pattern is a REGEX
    ftp_file_pattern = 'man-pages-3.16.tar.bz2$',
    ftp_output_dir = '/tmp/ftp_downloads',
)

client.add_request(kernel_archive_readme)
client.add_request(kernel_manpages)

client.execute()

print "Done, please check output directories for files"
Пример #2
0
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License. 

"""
    Simple bullfrog example to pull down multiple rss feeds from
    in parallel, print out item headlines and if site was using http compression.
"""
import os,sys
from xml.dom.minidom import parse, parseString

import pathsetup
from client import ClientManager, Request

# Bullfrog Request
print "Create Client Manager"
client = ClientManager()
client.add_request(source='http://www.gamespot.com/rss/game_updates.php?', accept_compressed=True, timeout=2, nocache=True, key='Gamespot')
client.add_request(source='http://news.cnet.com/2547-1_3-0-20.xml', accept_compressed=True, nocache=True, key='News')
client.add_request(source='http://www.bnet.com/2408-11452_23-0.xml', nocache=True, key='The Insider')
result_set = client.execute()
print "Done executing Client Manager"

for r in result_set:
    if not r.exception:
        feed_dom = parseString(r.response_content) 
        for title in feed_dom.getElementsByTagName('title'):
                print r.key, "Headline: ", title.firstChild.data
        print "HTTP Compression Enabled: ", r.resp_was_compressed
        print "\n\n"