コード例 #1
0
 def requestTwiceWithDiffRequests(self, cookie, url1):
     request = BaseRequest.BaseRequest(requestsTest.option, cookie)
     html = request.getPage(url1)
     dir = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
     os.mkdir(dir)
     request1 = BaseRequest.BaseRequest(requestsTest.option, cookie)
     request1.downloadFromUrls(url1, dir)
コード例 #2
0
 def requestTwice(self, cookie, url1):
     request = BaseRequest.BaseRequest(requestsCoocieExpiredTest.option,
                                       cookie)
     html = request.getPage(url1)
     dir = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
     os.mkdir(dir)
     request.downloadFromUrls(url1, dir)
コード例 #3
0
    def startSplider(self):
        login_name = '13501884996'
        login_password = '******'
        provider = CockieProvider.CockieProvider(TaskManager.option)
        cookie = provider.login(login_name, login_password)

        fetchUrlThread = threading.Thread(target=self.getAllUrlsThread,
                                          args=(cookie, ))
        fetchUrlThread.start()

        dir = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
        os.mkdir(dir)
        request = BaseRequest.BaseRequest(TaskManager.option, cookie)
        downloadThread = threading.Thread(target=self.download,
                                          args=(request, dir))
        downloadThread.start()
コード例 #4
0
 def requestOnce(self, cookie, url, dir):
     request = BaseRequest.BaseRequest(requestsCoocieExpiredTest.option,
                                       cookie)
     #html=request.getPage(url)
     request.downloadFromUrls(url, dir)
コード例 #5
0
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
# 
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
# 
# Contractor Name:        Raytheon Company
# Contractor Address:     6825 Pine Street, Suite 340
#                         Mail Stop B8
#                         Omaha, NE 68106
#                         402.291.0100
# 
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
import BaseRequest
dataRequest = BaseRequest.BaseRequest("obs")
dataRequest.setCount(%COUNT%)
dataRequest.addParameter("reportType", "METAR")
dataRequest.addParameter("location.stationId", "%STATION%")
return dataRequest.execute()
コード例 #6
0
 def requestOnce(self, cookie, url2):
     request = BaseRequest.BaseRequest(requestsTest.option, cookie)
     #html=request.getPage(url2)
     dir = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
     os.mkdir(dir)
     request.downloadFromUrls(url2, dir)
コード例 #7
0
 def __init__(self, cookie, option):
     self.cookie = cookie
     self.option = option
     #self.request=requests.session();
     self.request = BaseRequest.BaseRequest(option, cookie)