Subversion Repositories SmartDukaan

Rev

Rev 1782 | Rev 1786 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1782 Rev 1785
Line 246... Line 246...
246
  def body_callback(self, buf):
246
  def body_callback(self, buf):
247
    self.contents = self.contents + buf
247
    self.contents = self.contents + buf
248
 
248
 
249
 
249
 
250
def main():
250
def main():
251
  for search_string in SEARCH_STRINGS:
251
  for search_string in SEARCH_STRINGS[0:1]:
252
    find_google_position(search_string)
252
    find_google_position(search_string)
253
 
253
 
254
def init_curl(rankRequest, rankCheck):
254
def init_curl(rankRequest, rankCheck):
255
  # set up curl:
255
  # set up curl:
256
  rankRequest.setopt(pycurl.USERAGENT, USER_AGENT)
256
  rankRequest.setopt(pycurl.USERAGENT, USER_AGENT)
Line 299... Line 299...
299
  for i in range(0, MAX_PAGE):
299
  for i in range(0, MAX_PAGE):
300
    result = search_page(i, ENGINE_URL)
300
    result = search_page(i, ENGINE_URL)
301
    if result != 0:
301
    if result != 0:
302
      break
302
      break
303
 
303
 
-
 
304
  f = open('/var/lib/tomcat6/webapps/db/googleranks/rank.txt', 'a')
-
 
305
 
304
  # show results
306
  # show results
305
  if result == 0:
307
  if result == 0:
306
    print "%s, %s, %d, %d" % (datetime.datetime.now().strftime("%Y-%m-%d %H:%M"), search_string, NUM_PER_PAGE*MAX_PAGE, MAX_PAGE*NUM_PER_PAGE/10)
308
    f.write("{0:s}, {1:s}, {2:d}, {3:d}".format(datetime.datetime.now().strftime("%Y-%m-%d %H:%M"), search_string, NUM_PER_PAGE*MAX_PAGE, MAX_PAGE*NUM_PER_PAGE/10))
307
  else:
309
  else:
308
    print "%s, %s, %d, %d" % (datetime.datetime.now().strftime("%Y-%m-%d %H:%M"), search_string, result, result/10 + 1)
310
    f.write("{0:s}, {1:s}, {2:d}, {3:d}".format(datetime.datetime.now().strftime("%Y-%m-%d %H:%M"), search_string, result, result/10 + 1))
309
 
311
 
310
 
312
 
311
# Run Main
313
# Run Main
312
main()
314
main()