source: titan/mediathek/localhoster/cloudflare.py @ 39606

Last change on this file since 39606 was 39606, checked in by obi, 3 years ago

cleanup

File size: 815 bytes
Line 
1
2import urllib2
3from lib import helpers
4import sys
5from lib.net import Net
6import lib.common as common
7
8class CloudflareResolver(object):
9    def __init__(self):
10#        self.net = Net(cookie_file='/mnt/network/cookies', http_debug=True, cloudflare=True)
11        self.net = Net(cookie_file='/mnt/network/cookies', cloudflare=True)
12        url = str(sys.argv[1])
13        return self.get_answer_code(url)
14
15    def get_answer_code(self, web_url):
16        headers = {'User-Agent': common.FF_USER_AGENT}                 
17        html = self.net.http_GET(web_url, headers=headers).content
18        #html = self.request(web_url, cookie_file=/mnt/network/cookies, cloudflare=True)
19        ret = self.net.save_cookies('/mnt/network/cookies')     
20        print "html", html.encode('utf8')
21
22sys.stdout = CloudflareResolver()
Note: See TracBrowser for help on using the repository browser.