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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T02:00:32+00:00 2026-05-13T02:00:32+00:00

When I view the source of the page in my browser (FireFox) (View->Page Source),

  • 0

When I view the source of the page in my browser (FireFox) (View->Page Source), copy it and paste it into my HTML editor, I view almost the same page (In this example it is http://www.google.com) as it appears in my browser. But when I get the HTML source through this code (through Googles App Engines)

from google.appengine.api import urlfetch
url = "http://www.google.com/"
result = urlfetch.fetch(url)
if result.status_code == 200:
   print result.content

copy it and paste it into my HTML editor, the page then looks quite different. Why is it so? Is there something wrong with the code?

++++++++++++++++++++++++++++++

Follow-up:

By this moment (Sunday, December 13th, 2009, 1:01 PM, GMT, to be precise) I have received two comments-questions (from Aaron and Christian P.) and one answer from Alex Martelli.

Both Aaron and Christian P. are asking about what actually is different between the Fire-Fox-obtained source and Google-App-Engine-obtained source when they are both displayed through the same HTML editor.

Here I have uploaded too screen shots:

One shows the Fire-Fox-obtained source

And the other one shows Google-App-Engine-obtained source

when they are both displayed through “MS Front Page” editor.

One difference, which is quite obvious, is different encoding: In Fire-Fox code everything is displayed in English, while in the Google-App-Engine code I get a lot of various symbols, instead.

Another difference is some additional lines at the top of the page in the Google App Engine code. I think, this is what Alex Martelli was talking about in his answer (“…the fetch-and-print approach is going to have metadata around it as well…”).

One more minor difference is that the box for the Google image is split into several boxes in one code, while it remains whole in the other one.

Alex Martelli suggested that I use this code (if I understood him correctly):

from google.appengine.api import urlfetch
url = "http://www.google.com/"
result = urlfetch.fetch(url)
if result.status_code == 200:
   print "content-type: text/plain"
   print

I’ve tried it, but in this case nothing is displayed at all.

Thank you all for your responses and, please, continue responding – I really want to see this issue finally resolved.

++++++++++++++++++++++++++++++

Follow-up:

Okay, the issue has been resolved.

I failed to pay my full attention to Alex Martelli‘s instructions and, therefore, came up with a wrong code. Here is he right one:

from google.appengine.api import urlfetch
url = "http://www.google.com/"
result = urlfetch.fetch(url)
if result.status_code == 200:
   print "content-type: text/plain"
   print
   print result.content

This code displays exactly what is needed – no additional lines at the top of the page.

Well, I still get the strange symbols, but I discovered that it’s probably Google’s problem. The thing is I am currently in Taiwan, and Google seems to be aware of that and automatically switches from http://www.google.com (which is in English) to http://www.google.com.tw (which is in Chinese), but this one, I guess, is already another topic.

Thanks to everyone who has responded here.

  • 1 1 Answer
  • 2 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-13T02:00:33+00:00Added an answer on May 13, 2026 at 2:00 am

    You have not explicitly emitted a “content type” header, and an end-of-headers empty line, so the first few lines are probably going to be lost; try adding before the final print something like

       print "content-type: text/plain"
       print
    

    Beyond this, what you’re getting in either case is essentially a big <script> with a little extra HTML around it — that’s all that Firefox is going to give you in the “view source” page, while the fetch-and-print approach is going to have metadata around it as well, e.g., the “doctype” (depending on what HTML editor you’re targeting, this may or may not be an issue).

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

Sidebar

Related Questions

I am creating a dialog like in this page: http://jqueryui.com/demos/dialog/#modal-confirmation (click view source) on
In Firefox (Windows) when you view source from the browser it will not update
If you view source on http://seeitornot.co/prometheus/771228969 , you'll see html in the including the
I want to execute this script (view source) that uses Google Translate AJAX API
https://search.twitter.com/search.json?q=doug How do I read this like VIEW SOURCE, so that I know what
Please visit the following page with Firefox or any other browser AND Internet Explorer:
Basically, if I rightclick in any browser and choose to view source the code
For example, after click the 1st cell of of the table on this page
Am trying to do hide the actual content in the page source. For example
I was checking the view source of the site http://mothereffinghsl.com/ . It was coded

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.