Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access the web with Python?

Tags:

python

I want to access websites without using their API. Would i do this by using something like Mechanize?

like image 431
user216171 Avatar asked Jul 21 '10 18:07

user216171


People also ask

Can you use Python to interact with websites?

The technique of automating the web with Python works great for many tasks, both general and in my field of data science. For example, we could use selenium to automatically download new data files every day (assuming the website doesn't have an API).

How do I get the URL data in Python?

To get data from a website while programming, we need to open the URL. In this Article, I have discussed the methods to open URLs in python on Ubuntu (Linux System). Two ways are being discussed with examples, one is by importing the “urllib. request” module and other is by importing the “webbrowser” module in python.


1 Answers

#for Python 3.2
import urllib.request
page = urllib.request.urlopen("http://www.google.com")
print (page.read())
like image 167
Aniket Avatar answered Sep 28 '22 17:09

Aniket