Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #69233 > unrolled thread

implementing download using a url call

Started bytanmay.kansara@gmail.com
First post2014-03-27 18:34 -0700
Last post2014-03-28 06:27 -0700
Articles 3 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  implementing download using a url call tanmay.kansara@gmail.com - 2014-03-27 18:34 -0700
    Re: implementing download using a url call Chris Angelico <rosuav@gmail.com> - 2014-03-28 13:26 +1100
      Re: implementing download using a url call tanmay.kansara@gmail.com - 2014-03-28 06:27 -0700

#69233 — implementing download using a url call

Fromtanmay.kansara@gmail.com
Date2014-03-27 18:34 -0700
Subjectimplementing download using a url call
Message-ID<d58f6cea-c290-41f6-8f06-47c317243a8f@googlegroups.com>
Hey Guys,

here is what I am trying to solve. 

I have a URL - somesite.com/server/pattern.x?some_more_stuff

This URl is out there as an href tag on users website. Is there a way in which I can serve a file(not from my server) while ensuring that the users remain on the third party website. I am currently using this :

myfile = "http://download.someothersite.com/somefile.exe"
    
    meta_tag = "<html><head><meta http-equiv='Refresh' Content='1;URL=%s'></head></html>" % myfile
    return HttpResponse(meta_tag, content_type='force-download')

The above works, however the user gets redirected to a blank page. Would downloading and serving the file from my server be a better option? If so, some pointers please.

Do let me know what would be an elegant solution. The file sizes should be about 500kb(stub files).

Thanks

[toc] | [next] | [standalone]


#69241

FromChris Angelico <rosuav@gmail.com>
Date2014-03-28 13:26 +1100
Message-ID<mailman.8652.1395973614.18130.python-list@python.org>
In reply to#69233
On Fri, Mar 28, 2014 at 12:34 PM,  <tanmay.kansara@gmail.com> wrote:
> Hey Guys,
>
> here is what I am trying to solve.
>
> I have a URL - somesite.com/server/pattern.x?some_more_stuff
>
> This URl is out there as an href tag on users website. Is there a way in which I can serve a file(not from my server) while ensuring that the users remain on the third party website. I am currently using this :
>
> myfile = "http://download.someothersite.com/somefile.exe"
>
>     meta_tag = "<html><head><meta http-equiv='Refresh' Content='1;URL=%s'></head></html>" % myfile
>     return HttpResponse(meta_tag, content_type='force-download')
>
> The above works, however the user gets redirected to a blank page. Would downloading and serving the file from my server be a better option? If so, some pointers please.

So what you want is for the user to go to a page which both downloads
a file *and* displays content, is that it?

This is fairly common on the web today; have a look at how places like
Sourceforge do it.

ChrisA

[toc] | [prev] | [next] | [standalone]


#69273

Fromtanmay.kansara@gmail.com
Date2014-03-28 06:27 -0700
Message-ID<31de94dd-2ed7-431b-acb8-4771fe352031@googlegroups.com>
In reply to#69241
Hey

Sorry, I should make it more clear. We had a 3rd party that was serving stub builds and they have their URLs on various pages(random sites). We control the sub-domain, so i can send that traffic to wherever I want. I am looking to create logic that takes that incoming parameter and serves an exe file. 
With the logic I posted, the user gets the file, but also gets a new blank page. I would like to keep the user on the 3rd part website. 

Hope this clarifies. 

Thanks

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web