6 Replies - 3791 Views - Last Post: 13 June 2012 - 05:10 PM Rate Topic: -----

#1 crazy123  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 138
  • Joined: 04-August 11

url

Posted 11 June 2012 - 04:48 PM

I generate a url to a website. I need the result of this url.
Example:
I generate the url: http://test.com/search/1+2+3

To execute this url the site returns:
http://test.com/resu...d%=2&test.id%=3

I use webbrowser.open_new to open the url. How I get the url result in python?

This post has been edited by crazy123: 11 June 2012 - 04:49 PM


Is This A Good Question/Topic? 0
  • +

Replies To: url

#2 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 759
  • View blog
  • Posts: 2,010
  • Joined: 23-December 08

Re: url

Posted 11 June 2012 - 08:11 PM

I'm not sure exactly what you're looking for... but I suspect the answer is beautiful soup.

This post has been edited by atraub: 11 June 2012 - 08:18 PM

Was This Post Helpful? 0
  • +
  • -

#3 crazy123  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 138
  • Joined: 04-August 11

Re: url

Posted 12 June 2012 - 04:11 PM

View Postatraub, on 11 June 2012 - 08:11 PM, said:

I'm not sure exactly what you're looking for... but I suspect the answer is beautiful soup.


I do not know if there is a need to use beautiful soup.
What I need is to get the link of a page.

I send a key "test" to google search. After the search, the link of the browser is:
https://www.google.com/#hl=en&output=search&sclient=psy-ab&q=test&oq=test&aq=f&aqi=g4&aql=&gs_l=hp.3..0l4.3988.4664.0.5253.4.4.0.0.0.0.456.1647.3-1j3.4.0...0.0.2hp1-LeET4I&pbx=1&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.,cf.osb&fp=393c6639d5e66cd5&biw=1366&bih=667


I need get this url
Was This Post Helpful? 0
  • +
  • -

#4 darek9576  Icon User is offline

  • D.I.C Lover

Reputation: 198
  • View blog
  • Posts: 1,687
  • Joined: 13-March 10

Re: url

Posted 12 June 2012 - 06:05 PM

Can you not use regular expressions?
Was This Post Helpful? 0
  • +
  • -

#5 crazy123  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 138
  • Joined: 04-August 11

Re: url

Posted 12 June 2012 - 07:47 PM

View Postdarek9576, on 12 June 2012 - 06:05 PM, said:

Can you not use regular expressions?


How?
Was This Post Helpful? 0
  • +
  • -

#6 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6058
  • View blog
  • Posts: 23,495
  • Joined: 23-August 08

Re: url

Posted 13 June 2012 - 03:36 AM

urlparse (< Python 3)
urllib.parse (Python 3)
Was This Post Helpful? 0
  • +
  • -

#7 crazy123  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 138
  • Joined: 04-August 11

Re: url

Posted 13 June 2012 - 05:10 PM

View PostJackOfAllTrades, on 13 June 2012 - 03:36 AM, said:



OK. With urlparse I can find information about the site (scheme, netloc, hostname, port, path, params, query, fragment, username, password) but I need the url of the site. Right?

My problem is:
I send to the site a search
www.test.com/search/a+b+c
in this example the site search (in your database) information about a, b and c. After searching the site performs a query and change the url to
www.test.com/result/find?find.id%5B0%5D=a&find.id%5B1%5D=b&find.id%5B1%5D=c


In my program I generate the url
www.test.com/search/a+b+c
and I need get the result:
www.test.com/result/find?find.id%5B0%5D=a&find.id%5B1%5D=b&find.id%5B1%5D=c

This post has been edited by crazy123: 13 June 2012 - 05:11 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1