Connect python on a site

  • (2 Pages)
  • +
  • 1
  • 2

15 Replies - 845 Views - Last Post: 21 May 2012 - 06:53 PM Rate Topic: -----

#1 crazy123  Icon User is offline

  • D.I.C Head

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

Connect python on a site

Posted 07 May 2012 - 06:57 PM

It is possible with python, make a program to access a site (which provides data) and download the data?
Is This A Good Question/Topic? 0
  • +

Replies To: Connect python on a site

#2 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1716
  • View blog
  • Posts: 2,594
  • Joined: 21-June 11

Re: Connect python on a site

Posted 07 May 2012 - 06:58 PM

Yes.
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: Connect python on a site

Posted 07 May 2012 - 07:25 PM

View Postsepp2k, on 07 May 2012 - 06:58 PM, said:

Yes.


How can I do this? With socket?
Was This Post Helpful? 0
  • +
  • -

#4 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1716
  • View blog
  • Posts: 2,594
  • Joined: 21-June 11

Re: Connect python on a site

Posted 07 May 2012 - 07:42 PM

If all you want to do is download data form a given url, you can just use urllib.request.urlopen.
Was This Post Helpful? 1
  • +
  • -

#5 crazy123  Icon User is offline

  • D.I.C Head

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

Re: Connect python on a site

Posted 08 May 2012 - 04:10 AM

View Postsepp2k, on 07 May 2012 - 07:42 PM, said:

If all you want to do is download data form a given url, you can just use urllib.request.urlopen.


I need upload my file and download date of the site
Was This Post Helpful? 0
  • +
  • -

#6 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 734
  • View blog
  • Posts: 1,891
  • Joined: 23-December 08

Re: Connect python on a site

Posted 08 May 2012 - 12:52 PM

I'm assuming uploading files is a normal function of the site?
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: Connect python on a site

Posted 08 May 2012 - 03:36 PM

View Postatraub, on 08 May 2012 - 12:52 PM, said:

I'm assuming uploading files is a normal function of the site?


Uploading is to search data in the site (I send a file .txt to the site) and download these data searched.
Was This Post Helpful? 0
  • +
  • -

#8 crazy123  Icon User is offline

  • D.I.C Head

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

Re: Connect python on a site

Posted 08 May 2012 - 04:32 PM

I'd like to send data (urllib.urlencode??) for the field search of site. After obtaining the url of the search.
How can I do this?
Was This Post Helpful? 0
  • +
  • -

#9 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 734
  • View blog
  • Posts: 1,891
  • Joined: 23-December 08

Re: Connect python on a site

Posted 08 May 2012 - 04:38 PM

I'm sorry, but I'm having difficulty understanding you. Could you try asking your question in a different way?
Was This Post Helpful? 0
  • +
  • -

#10 crazy123  Icon User is offline

  • D.I.C Head

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

Re: Connect python on a site

Posted 08 May 2012 - 05:00 PM

View Postatraub, on 08 May 2012 - 04:38 PM, said:

I'm sorry, but I'm having difficulty understanding you. Could you try asking your question in a different way?

OK

The site has a search field (like google). In my python script I like to send which must be searched and get the url of the site after searching.
Was This Post Helpful? 0
  • +
  • -

#11 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 734
  • View blog
  • Posts: 1,891
  • Joined: 23-December 08

Re: Connect python on a site

Posted 08 May 2012 - 06:56 PM

so, you want to use a script to have the site run a search based on some input string.

Then, you want the URL of wherever that site sends you to?


If the site uses query strings, you might be able to get the URL of the search results without actually doing a search. For example, let's look at Google.

If I want to google the expression "gimme teh codez" I could just type in http://www.google.co...immeh+teh+codez if I wanted to search for "hello world" I could just go to http://www.google.co...h?q=hello+world Thus, for any string I want to search, I could replaces the spaces in the string with plus signs and append it to the back of http://www.google.com/search?q= It's possible you can utilize the same concept, but I'm really not the guy to ask.

P.S. this is called a query string.
Was This Post Helpful? 1
  • +
  • -

#12 crazy123  Icon User is offline

  • D.I.C Head

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

Re: Connect python on a site

Posted 10 May 2012 - 07:42 PM

View Postatraub, on 08 May 2012 - 06:56 PM, said:

so, you want to use a script to have the site run a search based on some input string.

Then, you want the URL of wherever that site sends you to?


If the site uses query strings, you might be able to get the URL of the search results without actually doing a search. For example, let's look at Google.

If I want to google the expression "gimme teh codez" I could just type in http://www.google.co...immeh+teh+codez if I wanted to search for "hello world" I could just go to http://www.google.co...h?q=hello+world Thus, for any string I want to search, I could replaces the spaces in the string with plus signs and append it to the back of http://www.google.com/search?q= It's possible you can utilize the same concept, but I'm really not the guy to ask.

P.S. this is called a query string.


Thanks. I can manipulate the url.
My problem now is that: I send my string to search the site and I can load the site. The site has a download button. How, in python, I click that button and I download files?

*I do not know the URL of the download
Was This Post Helpful? 0
  • +
  • -

#13 crazy123  Icon User is offline

  • D.I.C Head

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

Re: Connect python on a site

Posted 21 May 2012 - 04:10 PM

On a site like this: http://www.geonames.org
I can send the information to search in site. How to download data from the search?
Was This Post Helpful? 0
  • +
  • -

#14 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 734
  • View blog
  • Posts: 1,891
  • Joined: 23-December 08

Re: Connect python on a site

Posted 21 May 2012 - 06:06 PM

Research website scraping such as scrapy or beautiful soup.
Was This Post Helpful? 0
  • +
  • -

#15 crazy123  Icon User is offline

  • D.I.C Head

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

Re: Connect python on a site

Posted 21 May 2012 - 06:46 PM

View Postatraub, on 21 May 2012 - 06:06 PM, said:

Research website scraping such as scrapy or beautiful soup.


OK. Using scrapy and BeautifulSoup I can navigating in site. But how to download the contents of the site?
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2