Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #58202
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <joel.goldstick@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.029 |
| X-Spam-Evidence | '*H*': 0.94; '*S*': 0.00; 'append': 0.09; 'http': 0.09; 'parameter': 0.09; 'subject:How': 0.10; 'cc:addr:python- list': 0.11; 'handler.': 0.16; 'headers.': 0.16; 'landing': 0.16; 'roy': 0.16; 'subject:URL': 0.16; 'subject:after': 0.16; 'url.': 0.16; 'url:creative': 0.16; 'url:tag': 0.16; 'thursday,': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'library': 0.18; 'thu,': 0.19; 'code,': 0.22; 'example': 0.22; 'cc:addr:python.org': 0.22; '31,': 0.24; 'body,': 0.24; 'headers': 0.24; 'url:utf8': 0.24; "haven't": 0.24; 'looks': 0.24; '(or': 0.24; 'environment': 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'asking': 0.27; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; "doesn't": 0.30; 'url:gp': 0.30; 'message- id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; 'requests': 0.31; "skip:' 10": 0.31; 'that.': 0.31; 'url:category': 0.31; 'url:python': 0.33; 'proceed': 0.33; 'something': 0.35; 'case,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'google': 0.35; 'really': 0.36; 'url:ie': 0.36; 'url:ref': 0.36; 'done': 0.36; 'url:listinfo': 0.36; 'similar': 0.36; 'url:org': 0.36; 'question,': 0.38; 'url:amazon': 0.38; 'pm,': 0.38; 'does': 0.39; 'url:mail': 0.40; 'helps': 0.61; 'include:': 0.61; 'location:': 0.61; 'tracking': 0.61; 'full': 0.61; "you're": 0.61; 'kind': 0.63; 'provide': 0.64; 'details': 0.65; 'smith': 0.68; 'subject:get': 0.81; 'horrible': 0.84; 'url:php': 0.85; 'joel': 0.91; 'thing,': 0.91; 'url:latest': 0.91; 'examine': 0.93; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=B6DtS2ID22YeAfoJUWUzw5wB9QNtUv+e1Ws5mfqUhfs=; b=nre1UknCGTXT9uyZQwRniBeHg8qZj5fOXvkuRRNfm3h1OOF5o3+vhufKtGl3mhdxF5 Ph3ZgTo1TqE/2NUtcTCcMZ9WM8VYQuFy7Sl/T9iaNGaTi9gumzlKmz9hIVqBTCAFQBxD jODo5R/oWdgQeQepuzmuPACbmrwCuYN630LpFWFXmURrkcJ+Fg3DfLu+gv48TZ2GLPYS bPZLutsFENynGCUhRRKRIxm3NMIKZtRBB8b7MOytoOKOPC3mmZFVmqixYV/qrnoiKhQv DjB9UXRoT5N7vrEetCyAJOxEgm14ckK21XyTZebcn3jwi3gGyncAfyT5mLwkWUrp9QGS RolQ== |
| MIME-Version | 1.0 |
| X-Received | by 10.58.226.233 with SMTP id rv9mr383360vec.56.1383244980931; Thu, 31 Oct 2013 11:43:00 -0700 (PDT) |
| In-Reply-To | <db178cf8-2cf7-4cbb-b13a-2f60f2be2b87@googlegroups.com> |
| References | <d728b722-d978-4f94-b053-e0374a09ffbb@googlegroups.com> <mailman.1887.1383242269.18130.python-list@python.org> <d6745f8b-ff1a-4b06-958d-e34f75304fd6@googlegroups.com> <db178cf8-2cf7-4cbb-b13a-2f60f2be2b87@googlegroups.com> |
| Date | Thu, 31 Oct 2013 14:43:00 -0400 |
| Subject | Re: How to get final URL after redirection |
| From | Joel Goldstick <joel.goldstick@gmail.com> |
| To | Roy Smith <roy@panix.com> |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | "python-list@python.org" <python-list@python.org> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1888.1383244990.18130.python-list@python.org> (permalink) |
| Lines | 42 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1383244990 news.xs4all.nl 15922 [2001:888:2000:d::a6]:47878 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:58202 |
Show key headers only | View raw
On Thu, Oct 31, 2013 at 2:33 PM, Roy Smith <roy@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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to get final URL after redirection nishant bhakta <bhaktanishant@gmail.com> - 2013-10-31 09:17 -0700
Re: How to get final URL after redirection Andreas Perstinger <andipersti@gmail.com> - 2013-10-31 18:42 +0100
Re: How to get final URL after redirection nishant bhakta <bhaktanishant@gmail.com> - 2013-10-31 11:10 -0700
Re: How to get final URL after redirection Roy Smith <roy@panix.com> - 2013-10-31 11:33 -0700
Re: How to get final URL after redirection Joel Goldstick <joel.goldstick@gmail.com> - 2013-10-31 14:43 -0400
Re: How to get final URL after redirection Roy Smith <roy@panix.com> - 2013-10-31 14:50 -0400
csiph-web