On Thu, Oct 31, 2013 at 2:33 PM, Roy Smith <r...@panix.com> wrote:
> On Thursday, October 31, 2013 2:10:35 PM UTC-4, nishant bhakta wrote:
>
>> I was only giving an example as bitly, actually i need to proceed with 
>> "http://www.mysmartprice.com/out/sendtostore.php?id=107120529&top_category=electronics&store=amazon&mspid=51889&category=computer&rk=30";
>>  this is the link that landed at "www.amazong.com" and i want write code 
>> that take this link and append something to the final landing link that is 
>> "www.amazon.com"
>
> When asking a question, it really helps to ask the question you want to ask, 
> not some other question which you think is similar :-)  Details matter.
>
> The "normal" way a redirect is done is to return a 301 (or 302) status code, 
> and include a Location: line in the HTTP response headers.  If that was the 
> case, you would just do a GET on the url with a library like requests and 
> examine the status code and headers in the response object you got back.
>
> This URL, however, doesn't do that.  What it does do is include:
>
> <meta http-equiv="Refresh"  content="0; 
> url=http://amazon.in/gp/offer-listing/B00AF856T2/?/ref=as_li_tf_tl?ie=UTF8&camp=3626&creative=24790&creativeASIN=9380349300&linkCode=as2&tag=mysm-21";>
>
> in the body, which does kind of the same thing, but in a horrible way.  I 
> suspect they do this provide a hook for the google analytics tracking code in 
> the window.onload handler.  Unless you wanted to include a full HTML and 
> javascript execution environment in your application, you're pretty much 
> toast here.
> --
> https://mail.python.org/mailman/listinfo/python-list

You might look at the requests module:
http://www.python-requests.org/en/latest/api/

It has an 'allow_redirects' parameter that looks like you can set to
get the final url.  Haven't tried it

-- 
Joel Goldstick
http://joelgoldstick.com
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to