0

This seems like a very simple question, so I will remove if it's a repeat. I just can't seem to find the answer.

I'm using the feedparser module to parse an RSS feed. I want to post the output to a widget on a site. I don't want the python script to write the whole page. I just want to be able to get the output to the web page. Can anyone just point me in the right direction?

Details:

I have a blog that is run separately from the page that I would like to post the RSS Feed on. I have the script to parse the blog and generate the info I want. I want to get the generated output into an iframe or table or the like on a static HTML page. The static page is entirely separate from the blog.

Jackson Egan
  • 2,715
  • 4
  • 18
  • 26
  • 1
    Not sure about the part of "post output to a widget on a site" and "get output to the webpage". What is your set up? – VKen Oct 13 '12 at 01:14
  • I'm not sure this is generally answerable. It depends on what you're using to create the rest of the web page, and what you mean by "widget". Generally speaking, if you want to dynamically generate part of a page, you have to dynamically generate the whole thing. (Even if the content is mostly static.) – millimoose Oct 13 '12 at 01:15
  • Sorry. Added some more info. :/ – Jackson Egan Oct 13 '12 at 01:20
  • 1
    Are you generating a bunch html of code to cut-and-paste since it is static? Or do you dynamically parse the feed every set interval and then generate the content for the widget? – VKen Oct 13 '12 at 01:22
  • Okay. I guess I was being very unclear. I sincerely apologize. Edit forthcoming. – Jackson Egan Oct 13 '12 at 01:25
  • Sorry, there are a lot of questions to be clarified before we can even start helping. So you have generated info, and you are trying to find a way to programmatically insert that info into another page? What control do you have over the new page? Are you using some blogging/web framework? How is the new html page updated? Which part of this process do you need help in? – VKen Oct 13 '12 at 01:34
  • The HTML Page is on my server. I wrote it and I update it myself. I can write some code in the HTML page if that's what I need to do. I sort of expected to be told to write the output to a text file and pull it into the HTML page or something. This is my first foray into writing my own script, so I apologize for my naiveté. – Jackson Egan Oct 13 '12 at 01:38
  • 1
    Ah, I see, so you are hand-editing everything, even running the script manually? No frame-work at all? This sounds tedious. There are a lot of ways to go about it, but I'll focus on the design decision question first. To make things simple, create two pages. First page for displaying the generated info without the generated info, just the styling and all other icing on the cake. Include an ` – VKen Oct 13 '12 at 01:44
  • Can you point me in the direction of one of the Frameworks you mention? I'm ready to learn and this is not time sensitive. :) – Jackson Egan Oct 13 '12 at 01:46
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/17963/discussion-between-vken-and-sneagan) – VKen Oct 13 '12 at 01:48

2 Answers2

1

One of several options: i'm thinking this might be quickest/easiest...

Upload the python script to the server. Have it create/update a publicly readable file under the webroot. Write some javascript to load that page into your html page.

If you want to get fancy schedule the script to run periodically via cron.

John Mee
  • 50,179
  • 34
  • 152
  • 186
1

I'll paste my comment into the answer here as well.

There are a lot of ways to go about it, but I'll focus on the design decision question first.

To make things simple, create two pages. First page for displaying the generated info without the generated info, just the styling and all other icing on the cake. Include an which point to the second page, which is the generated content.

John's answer has a good method of solving the problem of manually running the script: by using cron.

VKen
  • 4,964
  • 4
  • 31
  • 43