當前位置: 首頁>>代碼示例>>Python>>正文


Python Download.doRequest方法代碼示例

本文整理匯總了Python中Download.Download.doRequest方法的典型用法代碼示例。如果您正苦於以下問題:Python Download.doRequest方法的具體用法?Python Download.doRequest怎麽用?Python Download.doRequest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Download.Download的用法示例。


在下文中一共展示了Download.doRequest方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: doRequest

# 需要導入模塊: from Download import Download [as 別名]
# 或者: from Download.Download import doRequest [as 別名]
 def doRequest(self):
   d = Download(self.Url)
   if d.doRequest():
     return 1
   
   self.recs = d.getSOURCE()
   return 0
開發者ID:csrgxtu,項目名稱:maxent,代碼行數:9,代碼來源:Players.py

示例2: isGoogleSearch

# 需要導入模塊: from Download import Download [as 別名]
# 或者: from Download.Download import doRequest [as 別名]
def isGoogleSearch(schema, ip):
  d = Download(schema + '://' + ip)
  if d.doRequest():
    return False

  if Utility.containsGoogle(d.getSOURCE()):
    return True
  
  return False
開發者ID:Amforever,項目名稱:GoogleHosts-Python,代碼行數:11,代碼來源:Utility.py

示例3: run

# 需要導入模塊: from Download import Download [as 別名]
# 或者: from Download.Download import doRequest [as 別名]
    def run(self):
        url = self.BASE_URL + self.SeasonId + self.BASE_URL_PART_3 + str(self.PageNumber) + self.BASE_URL_PART_5
        d = Download(url)
        if d.doRequest():
            # fail
            print 'ERROR: ' + self.SeasonId + '-' + str(self.PageNumber)
        else:
            utfstr2file(d.getSOURCE(), './data/' + self.SeasonId + '-' + str(self.PageNumber) + '.raw')

        return url
開發者ID:csrgxtu,項目名稱:maxent,代碼行數:12,代碼來源:OddsDownloader.py

示例4: requestHtml

# 需要導入模塊: from Download import Download [as 別名]
# 或者: from Download.Download import doRequest [as 別名]
    def requestHtml(self):
        url = self.BaseUrl + self.ISBN
        # print url, self.User_Agent
        d = Download(url, self.User_Agent)
        if d.doRequest():
            return 1

        self.HTML = d.getSOURCE()

        return 0
開發者ID:xiangxiaobaog3,項目名稱:BeautifulReading,代碼行數:12,代碼來源:BookAPI.py

示例5: request

# 需要導入模塊: from Download import Download [as 別名]
# 或者: from Download.Download import doRequest [as 別名]
    def request(self):
        baseUrl = "http://shaishufang.com/index.php/site/main/uid/"
        postFix = "/friend/false/category//status//type//page/"
        url = baseUrl + self.UID + postFix + str(self.Page)

        d = Download(url, self.Cookie, self.Proxy)
        if d.doRequest():
            return False

        self.HTML = d.getSOURCE()
        return True
開發者ID:xiangxiaobaog3,項目名稱:BeautifulReading,代碼行數:13,代碼來源:UserBooks.py

示例6: request

# 需要導入模塊: from Download import Download [as 別名]
# 或者: from Download.Download import doRequest [as 別名]
    def request(self):
        baseUrl = 'http://shaishufang.com/index.php/site/detail/uid/'
        postFix = '/status//category/none/friend/false'
        url = baseUrl + self.UID + '/ubid/' + self.BID + postFix

        d = Download(url, self.Cookie, self.Proxy)
        if d.doRequest():
            return False

        self.HTML = d.getSOURCE()
        return True
開發者ID:xiangxiaobaog3,項目名稱:BeautifulReading,代碼行數:13,代碼來源:BookInfo.py

示例7: run

# 需要導入模塊: from Download import Download [as 別名]
# 或者: from Download.Download import doRequest [as 別名]
  def run(self):
    while True:
      print 'INFO: ........................................ START'
      stats = self.dbm.getStats()
      print 'INFO: deadLinks-', stats[0], ' unvisitedLinks-', stats[1], ' visitedLinks-', stats[2]
      # get an url from unvisitedLinks
      url = self.dbm.retrieveUnvisitedLink()
      if url == False:
        print 'DEBUG: DONE -- retrieveUnvisitedLink return False'
        break

      print 'DEBUG: Processing ', url

      if not self.urlFilter.isPlainText(url):
        print 'DEBUG: NotPlainTextURL ', url
        continue
      
      if not self.domainFilter.isInDomain(url):
        print 'DEBUG: NOT IN DOMAIN ', url
        continue

      # requet the url
      d = Download(url)
      if d.doRequest() == 1:
        if not self.dbm.createDeadLink(url):
          print 'DEBUG: deadLinks already contain ', url
        else:
          print 'DEBUG: Add To deadLinks ', url
      else:
        if self.dbm.createVisitedLink(url):
          print 'DEBUG: Add To visitedLinks ', url
        else:
          print 'DEBUG: Failed Add To visitedLinks ', url

        # extract urls from the sourc2
        u = URLExtractor(d.getSOURCE(), url)
        tmpUrls = u.getUrls()
        if tmpUrls:
          for url in tmpUrls:
            if self.dbm.isInDeadLink(url):
              continue
            elif self.dbm.isInVisitedLink(url):
              continue
            elif self.dbm.isInUnvisitedLink(url):
              continue
            else:
              print 'DEBUG: Add To unvisitedLink ', url
              self.dbm.createUnvisitedLink(url)
    
      print 'INFO: ........................................ END'
開發者ID:csrgxtu,項目名稱:ShardowWalker,代碼行數:52,代碼來源:ShadowWalker.py

示例8: run

# 需要導入模塊: from Download import Download [as 別名]
# 或者: from Download.Download import doRequest [as 別名]
    def run(self, processName='MainProcess'):
        for isbn in self.ISBNS:
            url = 'http://www.amazon.cn/s/ref=nb_sb_noss?field-keywords=' + isbn
            d = Download(url)
            if d.doRequest():
                print 'ERROR[' + processName + ']: ', isbn, 'NERR'
                appendstr2file(isbn, './NERR.txt')
                continue

            asin = ASINParser(d.getSOURCE())
            if asin.getAsin():
                print 'INFO[' + processName + ']: ', isbn, asin.getAsin()
                appendstr2file(isbn + ',' + asin.getAsin(), './OK.txt')
            else:
                print 'WARN[' + processName + ']: ', isbn, 'NOER'
                appendstr2file(isbn, './NOER.txt')
開發者ID:xiangxiaobaog3,項目名稱:BeautifulReading,代碼行數:18,代碼來源:ISBN2ASIN.py

示例9: worker

# 需要導入模塊: from Download import Download [as 別名]
# 或者: from Download.Download import doRequest [as 別名]
def worker(appids, isbns, appidsCycle):
    # appidsCycle = cycle(appids)

    for isbn in isbns:
        url = 'http://' + appidsCycle.next() + '.appspot.com/url?url=' + 'http://book.douban.com/isbn/' + str(isbn)
        # print 'DEBUG: ', url

        d = Download(url)
        if d.doRequest():
            print isbn, 'network error'
            continue

        j = json.loads(d.getSOURCE())
        print isbn, j['status_code']

    return
開發者ID:csrgxtu,項目名稱:crawler-slave,代碼行數:18,代碼來源:multiprocessingrobust.py

示例10: Google_Web_Search_Helper

# 需要導入模塊: from Download import Download [as 別名]
# 或者: from Download.Download import doRequest [as 別名]
def Google_Web_Search_Helper(q, hl='en', start=0):
  Google_Web_Search_URL = 'https://www.google.com/search?'

  if not q:
    return {}
  else:
    Google_Web_Search_URL = Google_Web_Search_URL + 'q=' + q

  Google_Web_Search_URL = Google_Web_Search_URL + '&hl=' + hl
  Google_Web_Search_URL = Google_Web_Search_URL + '&start=' + start

  d = Download(Google_Web_Search_URL)
  if d.doRequest():
    return {}
  else:
    g = GoogleSearchResultParser(d.getSOURCE())
    return g.getJson()
  """
開發者ID:csrgxtu,項目名稱:Google-Slave,代碼行數:20,代碼來源:Utility.py

示例11: run

# 需要導入模塊: from Download import Download [as 別名]
# 或者: from Download.Download import doRequest [as 別名]
    def run(self, processName='MainProcess'):
        for asin in self.ASINS:
            url = 'http://www.amazon.cn/dp/' + asin
            d = Download(url)
            if d.doRequest():
                print 'ERROR[' + processName + ']: ', asin, 'NERR'
                appendstr2file(asin, './NERRBasicInfo.txt')
                continue

            b = BasicInfoParser(d.getSOURCE())
            jsonRes = b.basicInfo()

            if json.loads(jsonRes):
                print 'info[' + processName + ']: ', asin
                appendstr2file(jsonRes, './OKBasicInfo.txt')
            else:
                print 'WARN[' + processName + ']: ', asin, 'NOER'
                appendstr2file(asin, './NOERBasicInfo.txt')
開發者ID:xiangxiaobaog3,項目名稱:BeautifulReading,代碼行數:20,代碼來源:BasicInfoScraper.py

示例12: walker

# 需要導入模塊: from Download import Download [as 別名]
# 或者: from Download.Download import doRequest [as 別名]
  def walker(self):
    while True:
      urls = self.dbm.retrieveUnvisitedLinks(0, 100)
      urls = self.urlFilter.getFilteredUrls(urls)
      if len(urls) == 0:
        break

      for url in urls:
        print 'INFO: Processing ', url
        d = Download(url)
        if d.doRequest() == 1:
          self.dbm.createDeadLink(url)
        else:
          self.dbm.createVisitedLink(url)
          u = URLExtractor(d.getSOURCE(), url)
          tmpUrls = u.getUrls()
          if tmpUrls:
            self.dbm.createUnvisitedLinks(list(set(tmpUrls)))

    return True
開發者ID:csrgxtu,項目名稱:ShardowWalker,代碼行數:22,代碼來源:ShadowWalker.py

示例13: getStats

# 需要導入模塊: from Download import Download [as 別名]
# 或者: from Download.Download import doRequest [as 別名]
  def getStats(self):
    d = Download(self.API)
    if d.doRequest():
      return False

    res = []
    j = loads(d.getSOURCE())
    for item in j['resultSets'][0]['rowSet']:
      tmp = []
      name = item[3]
      pos = item[5]
      if item[6] == 'null':
        height = 'None'
      else:
        height = item[6]
      if item[7] == " ":
        weight = 'None'
      else:
        weight = item[7]
      age = item[9]
      if item[10] == 'R' or item[10] == 'None' or item[10] == None:
        exp = 0
      else:
        exp = item[10]

      tmp.append(name)
      tmp.append(pos)
      tmp.append(height)
      tmp.append(weight)
      tmp.append(age)
      tmp.append(exp)
      res.append(tmp)

    if len(res) == 0:
      return False
    else:
      return res
開發者ID:csrgxtu,項目名稱:maxent,代碼行數:39,代碼來源:NBAStatsTeamPlayerExtractorV1.py

示例14: Download

# 需要導入模塊: from Download import Download [as 別名]
# 或者: from Download.Download import doRequest [as 別名]
#!/usr/bin/env python
#coding=utf-8
#
# Author: Archer Reilly
# Date: 11/Aug/2014
# File: PlayerInfoParserTest.py
# Description: test the PlayerInfoParser class
# Website: http://csrgxtu.blog.com/
#
# Produced By CSRGXTU
from PlayerInfoParser import PlayerInfoParser
from Download import Download

URL = "http://sports.qq.com/d/f_players/3/2890/"
player = Download(URL)
if player.doRequest() != 0:
  print "Download Cant Do Requst"
else:
  print "Successfully Do Request"

playerParser = PlayerInfoParser(player.getSOURCE())

開發者ID:csrgxtu,項目名稱:maxent,代碼行數:23,代碼來源:PlayerInfoParserTest.py

示例15: doRequest

# 需要導入模塊: from Download import Download [as 別名]
# 或者: from Download.Download import doRequest [as 別名]
 def doRequest(self, url):
   d = Download(url)
   if d.doRequest() == None:
     return None
   else:
     return d.getSOURCE()
開發者ID:csrgxtu,項目名稱:maxent,代碼行數:8,代碼來源:TeamTechStatsExtractor.py


注:本文中的Download.Download.doRequest方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。