예제 #1
0
 def _setup_webkit(self):
     cookie_path = get_cookie_path()
     webkitgtkhacks.setup_cookie_storage(cookie_path)
     webkitgtkhacks.add_cookie('dmusic_download_manager_enabled',
                               '1.0.3',
                               '.amazon.com',
                               '/',
                               3600 * 365 * 10) # 10 years
예제 #2
0
 def _setup_webkit(self):
     cookie_path = get_cookie_path()
     webkitgtkhacks.setup_cookie_storage(cookie_path)
     webkitgtkhacks.add_cookie('dmusic_download_manager_enabled',
                               '1.0.3',
                               '.amazon.com',
                               '/',
                               3600 * 365 * 10) # 10 years
예제 #3
0
    def _init_handle(self):
        handle = pycurl.Curl()
        handle.setopt(pycurl.USERAGENT, user_agent())
        handle.setopt(pycurl.FOLLOWLOCATION, 1)
        handle.setopt(pycurl.MAXREDIRS, REDIRECTION_LIMIT)
        handle.setopt(pycurl.NOPROGRESS, 1)
        handle.setopt(pycurl.NOSIGNAL, 1)
        handle.setopt(pycurl.CONNECTTIMEOUT, net.SOCKET_CONNECT_TIMEOUT)
        if self.requires_cookies:
            # we don't do this for every request, since on OS X this generates
            # a new cookies.txt file
            handle.setopt(pycurl.COOKIEFILE, utils.get_cookie_path())

        # The following 2 settings makes it so that if we don't receive any
        # data after SOCKET_READ_TIMEOUT, the transfer ends in an error
        handle.setopt(pycurl.LOW_SPEED_LIMIT, 1)
        handle.setopt(pycurl.LOW_SPEED_TIME, net.SOCKET_READ_TIMEOUT)
        handle.setopt(pycurl.URL, self.url)
        if self.head_request:
            handle.setopt(pycurl.NOBODY, 1)
        self._setup_proxy(handle)
        return handle
예제 #4
0
파일: httpclient.py 프로젝트: adarshr/miro
    def _init_handle(self):
        handle = pycurl.Curl()
        handle.setopt(pycurl.USERAGENT, user_agent())
        handle.setopt(pycurl.FOLLOWLOCATION, 1)
        handle.setopt(pycurl.MAXREDIRS, REDIRECTION_LIMIT)
        handle.setopt(pycurl.NOPROGRESS, 1)
        handle.setopt(pycurl.NOSIGNAL, 1)
        handle.setopt(pycurl.CONNECTTIMEOUT, net.SOCKET_CONNECT_TIMEOUT)
        if self.requires_cookies:
            # we don't do this for every request, since on OS X this generates
            # a new cookies.txt file
            handle.setopt(pycurl.COOKIEFILE, utils.get_cookie_path())

        # The following 2 settings makes it so that if we don't receive any
        # data after SOCKET_READ_TIMEOUT, the transfer ends in an error
        handle.setopt(pycurl.LOW_SPEED_LIMIT, 1)
        handle.setopt(pycurl.LOW_SPEED_TIME, net.SOCKET_READ_TIMEOUT)
        handle.setopt(pycurl.URL, self.url)
        if self.head_request:
            handle.setopt(pycurl.NOBODY, 1)
        self._setup_proxy(handle)
        return handle
예제 #5
0
 def _setup_webkit(self):
     cookie_path = get_cookie_path()
     webkitgtkhacks.setup_cookie_storage(cookie_path)
     webkitgtkhacks.add_cookie(
         "dmusic_download_manager_enabled", "1.0.3", ".amazon.com", "/", 3600 * 365 * 10
     )  # 10 years