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 607249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:20:24+00:00 2026-05-13T17:20:24+00:00

I wrote a program that takes in a partial rss feed and outputs a

  • 0

I wrote a program that takes in a partial rss feed and outputs a full one, but it is one a case by case basis. The recipe for one site is not the same as the recipe for the other. So what I do is look at the domain basename(for instance nyt or wsj) and choose a module based on that. Though I need to load each and every module before hand and have a logical condition for each recipe.

What I need is a way to just have the individual modules in their own respective folder and when I parse out the url basename I want it to look for the module, load it and take some action. So I want the main code base to be independent from the modules. I want to be able to add the modules in the future and never touch the portion of code which interact with them.

Here is a code example

if "nyt" == feed:
        nyt.parser(posixpath.basename(url), urldir, rss_file_path, url, feed)

As you can see I call the parser of the individual module. I have many of these based on each website. I want to reed feed and then be able to look for the module, load it and call it, and then if it doesn’t exist report it and try the default method.

  • 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-05-13T17:20:25+00:00Added an answer on May 13, 2026 at 5:20 pm

    It sounds like you’re looking for the __import__ function. This function does the same thing as the import statement, but allows you to pass a name to import that might only be known at runtime.

    So you might do:

    parsemodule = __import__(feed)
    parsemodule.parser(posixpath.basename(url), urldir, rss_file_path, url, feed)
    

    You will want to catch exceptions such as ImportError.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a program that accepts and outputs Hebrew (i.e. right-to-left) text. In lieu
I recently wrote a program that takes inputted char data, tests if it is
I have one piece of Cocoa code I wrote that takes in an XML
I wrote a console program in c# that takes up to three files as
I need to write a program that takes input line at a time and
I'm trying to write a program that takes a large file (of any type)
I'm going to need to write a program that takes a list of persons
I have been assigned wit the task to write a program that takes a
I'm trying to write a simple program that takes in the users input, then
I want to write a simple program that takes a moderately sized wav file

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.