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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:57:36+00:00 2026-05-11T17:57:36+00:00

I need a little help getting a tar file to download from a website.

  • 0

I need a little help getting a tar file to download from a website. The website is set up as a form where you pick the file you want and click submit and then the download windows opens up for you to pick the location.

I’m trying to do the same thing in code (so I don’t have to manual pick each file). So far I have gotten python 2.5.2 to return a response but its in a socket._fileobject and I’m now not sure how to convert that into a file on my computer.

Below is output of the python shell and the steps I have taken

Python 2.5.2 on win32

IDLE 1.2.2      
>>> import urllib
>>> import urllib2
>>> url = 'http://website/getdata.php'
>>> values = {'data[]': 'filex.tar'}
>>> data = urllib.urlencode(values)
>>> req = urllib2.Request(url,data)
>>> response = urllib2.urlopen(req)
>>> response
addinfourl at 22250280 whose fp = <socket._fileobject object at 0x01534570
>>> response.fp
socket._fileobject object at 0x01534570
  • 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-11T17:57:37+00:00Added an answer on May 11, 2026 at 5:57 pm

    Append this:

    myfile = open('myfile.tar', 'wb')
    shutil.copyfileobj(response.fp, myfile)
    myfile.close()
    

    response.fp is a file-like object that you can read from, just like an open file. shutil.copyfileobj() is a simple function that reads from one file-like object and writes its contents to another.

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

Sidebar

Related Questions

I need a little help here: I get a file from an HTML upload
i need help in getting the below output from shops.xml file( where incity=yes and
Need a little help with my jquery here I want all my button with
I need a little help with my .htaccess before I deploy it! I want
guess its getting late, and Im a beginner, just need a little help.. Im
I need a little help with ClientDatasets in Delphi. What I want to achieve
So I need a little help with understanding the best way of getting input
I am just getting started with Code Contracts, and need a little help in
I need a little help with sending an HttpUrlConnection from my android application. Till
Need a little help getting the following rule working: RewriteCond %{HTTP_HOST} ^asset.*.domainone\.com [NC,AND] RewriteCond

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.