Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8254683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:16:34+00:00 2026-06-08T01:16:34+00:00

I’ve previously written applications, specifically data scrapers, in Node.js. These types of applications had

  • 0

I’ve previously written applications, specifically data scrapers, in Node.js. These types of applications had no web front end, but were merely processes timed with cron jobs to asynchronously make a number of possibly complicated HTTP GET requests to pull web pages, and then scrape and store the data from the results.

A sample of a function I might write would be this:

// Node.js

var request = require("request");

function scrapeEverything() {
    var listOfIds = [23423, 52356, 63462, 34673, 67436];

    for (var i = 0; i < listOfIds.length; i++) {
        request({uri: "http://mydatasite.com/?data_id = " + listOfIds[i]},
                function(err, response, body) {
                     var jsonobj = JSON.parse(body);
                      storeMyData(jsonobj);
                });
    }
}

This function loops through the IDs and makes a bunch of asynchronous GET requests, from which it then stores the data.

I’m now writing a scraper in Python and attempting to do the same thing using Tornado, but everything I see in the documentation refers to Tornado acting as a web server, which is not what I’m looking for. Anyone know how to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T01:16:36+00:00Added an answer on June 8, 2026 at 1:16 am

    Slightly more involved answer than I thought I would throw together, but it’s a quick demo of how to use Tornado ioloop and AsyncHTTPClient to fetch some data. I’ve actually written a webcrawler in Tornado, so it can be used “headless”.

    import tornado.ioloop
    import tornado.httpclient
    
    class Fetcher(object):
        def __init__(self, ioloop):
            self.ioloop = ioloop
            self.client = tornado.httpclient.AsyncHTTPClient(io_loop=ioloop)
    
        def fetch(self, url):
            self.client.fetch(url, self.handle_response)
    
        @property
        def active(self):
            """True if there are active fetching happening"""
    
            return len(self.client.active) != 0
    
        def handle_response(self, response):
            if response.error:
                print "Error:", response.error
            else:
                print "Got %d bytes" % (len(response.body))
    
            if not self.active:
                self.ioloop.stop()
    
    def main():
        ioloop = tornado.ioloop.IOLoop.instance()
        ioloop.add_callback(scrapeEverything)
        ioloop.start()
    
    def scrapeEverything():
        fetcher = Fetcher(tornado.ioloop.IOLoop.instance())
    
        listOfIds = [23423, 52356, 63462, 34673, 67436]
    
        for id in listOfIds:
            fetcher.fetch("http://mydatasite.com/?data_id=%d" % id)
    
    if __name__ == '__main__':
        main()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Seemingly simple, but I cannot find anything relevant on the web. What is the
I want to construct a data frame in an Rcpp function, but when I
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Specifically, suppose I start with the string string =hello \'i am \' me And
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.