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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:27:21+00:00 2026-05-26T01:27:21+00:00

If I enter this URL I will get some XML formatted text as a

  • 0

If I enter this URL I will get some XML formatted text as a response:

http://skrutten.nada.kth.se/scrut/svesve/?text=g%E5&url=&xmlout=on&x=Granska

Now I try to write a Python function that POST a message to the web page and I should get the same information. However, I am getting less information from the web page. It seems that some data are not “seen”(text) but I do not get any error messages. For instance, I am not sure if I am handling the coding in a correct way (I tried with utf-8 with no difference)

Any suggestions about my misstake?

def fetch_web (name, par1):
    """Fetch the web data defined by name and return a string with the web page"""

    if name == "granska":
        url = "http://skrutten.nada.kth.se/scrut/svesve/"
        values = {"text":par1,"xmlout":"on","x":"Granska","url":""}
        code = "ISO-8859-1"
    data = urllib.parse.urlencode(values)
    data = data.encode(code)

    req = urllib.request.Request(url,data)
    response = urllib.request.urlopen(req)

    page = response.read()
    return page.decode("ISO-8859-1")

print (fetch_web("granska","gå"))
  • 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-26T01:27:21+00:00Added an answer on May 26, 2026 at 1:27 am

    Try this

    def fetch_web (name, par1):
        """Fetch the web data defined by name and return a string with the web page"""
    
        if name == "granska":
            url = "http://skrutten.nada.kth.se/scrut/svesve/"
            values = {"text":par1,"xmlout":"on","x":"Granska","url":""}
            code = "ISO-8859-1"
    
        data = urllib.parse.urlencode(values)
        data = data.encode(code)
        full_url = "%s?%s" % (url, data)
    
        req = urllib.request.Request(full_url)
        response = urllib.request.urlopen(req)
    
        page = response.read()
        return page.decode("ISO-8859-1")
    
    print (fetch_web("granska","gå"))
    

    There may be issues caused by the lack of a file name at the end of a URL. I’ve experienced this same thing in the past with several of my scrips where it doesn’t add a “?” between the URL and post data when there is only a trailing “/” at the end of the URL. I think it’s a bug with the urllib2.Request class, but since I found a workaround I have been putting off looking into if a bug report exists or not.

    Also, if name != "granska" you are going to get an exception as url and values will be undefined variables when used in the data = ... lines.

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

Sidebar

Related Questions

I have url http://translate.google.ru/translate_a/t?client=x&text=ввійти вийти&sl=ua&tl=en If you will go through this link in response
in this page http://api.jquery.com/category/effects/ when you put 'up'(keyboard) and 'down',then put 'enter',it will go
I created this layout of successive text input fields, 1- Enter data into empty
When I enter a string that it not in the list, I get this
I'm trying to get an HttpRequest to post this URL https://www.iformbuilder.com/exzact/_emptyTable.php?PAGE_ID=1234&TABLE_NAME=table_name_here&USERNAME=yo@yo.com&PASSWORD=What!What ! I've tried
This is my first post and will appreciate if I can get the solution
<script type=text/javascript> function submitWindow() { .. // URL, name and attributes window.open('http://isivmwebtest.isolutionsinc.com/ComparativePricing/Content/PriceLookup.aspx','windowNew','width=300, height=300'); return
Open up a Rails console and enter this: 2.weeks.ago.between? 2.weeks.ago, 1.week.ago Did it give
i want something like this the user enter a website link i need check
I have this code in Python inputted = input(Enter in something: ) print(Input is

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.