Questions tagged [urlopen]

The urlopen is a method of the urllib library in Python, used to open a particular URL.

The urlopen is a method of the urllib library in Python, used to open a particular URL. As a result, a file-like object is returned that contains information about the URL - headers, response data and other details about the requested URL resource.

369 questions
2
votes
1 answer

how to deal with ® in url for urllib2.urlopen?

I received a url: https://www.packtpub.com/virtualization-and-cloud/citrix-xenapp®-75-desktop-virtualization-solutions; it is from…
2
votes
2 answers

urllib.error.URLError: python 3

I have this code in python 3.4 import urllib.request def read_text(): document = open(r"C:\mystuff\udacity\pruebatxt.txt") lec = document.read() document.close() print(lec) check_profanity(lec) def check_profanity…
Jasher
  • 31
  • 1
  • 1
  • 4
2
votes
1 answer

Python urlopen error

I've just bought synology NAS (DS213J) and I am trying to run a python script on it. My python script: 1 #!/opt/bin/python 2 3 import urllib 4 response = urllib.urlopen('http://google.com') 5 html = response.read() 6 print html when I…
Arek Woźniak
  • 695
  • 3
  • 12
  • 25
2
votes
2 answers

Python try/except statement for socket error Errno 10060

I have a Python 2.7 script that consists of opening/scraping multiple URLs from a database and extracting some information out of the webpages. The code can take up to 8 hours to run and I am dealing with multiple websites. Every now and then (1-2…
LaGuille
  • 1,658
  • 5
  • 20
  • 37
2
votes
1 answer

python encoding json with 'æøå'

Im trying to retrieve coordinates from an API but one of the json objects contains danish letters, and I keep getting an error. This is what I have: # -*- coding: utf-8 -*- import urllib2 import json import…
Philip
  • 944
  • 11
  • 26
2
votes
1 answer

urlopen with timeout fails behind proxy

python 2.7.3 under linux: getting strange behaviour when trying to use the timeout parameter from urllib2 import urlopen, Request, HTTPError, URLError url = "http://speedtest.website-solution.net/speedtest/random350x350.jpg" try: #f =…
steve cook
  • 3,116
  • 3
  • 30
  • 51
2
votes
0 answers

Miss data when using response = urllib2.urlopen(url) python

I am using urllib2 in python to get response from website. But response return miss some data. When I using file_get_contents in php, it return full data. This is code I using: response = urllib2.urlopen(url) print response.read()
hoangvu68
  • 845
  • 2
  • 13
  • 28
2
votes
3 answers

How to pass parameter to Url with Python urlopen

I'm currently new to python programming. My problem is that my python program doesn't seem to pass/encode the parameter properly to the ASP file that I've created. This is my sample code: import urllib.request url =…
Eduard
  • 666
  • 1
  • 8
  • 25
2
votes
1 answer

Urllib2 HTTPS truncated response

I am trying to fetch a page using urllib2.urlopen (actually, I am using mechanize, but this is the method that mechanize calls) When I fetch the page, I am getting incomplete responses; the page gets truncated. However, if I access the non-HTTPS…
sleblanc
  • 3,821
  • 1
  • 34
  • 42
1
vote
1 answer

Cannot create Soup from Guardian article fetched with urllib2.urlopen

I somehow cannot create a soup from a Guardian article I am fetching with urllib2.urlopen() when the same code works with another url. Here is my code: import urllib2 from bs4 import BeautifulSoup url =…
jrichalot
  • 59
  • 1
  • 7
1
vote
0 answers

Problems with urlopen and mysql

I want to get the plain text of web pages, where the urls are stored and then do an update in the same table adding the text. For some reason, after opening around 800 links the program ends. Here is part of the…
1
vote
2 answers

Python: KeyError/IOError with urllib.urlopen

I am trying to pass some text to this readability API like so: text = 'this reminds me of the Dutch 2001a caravan full of smoky people Auld Lang Syne' # construct Readability Metrics API url request_url =…
soulprovidr
  • 754
  • 3
  • 14
1
vote
1 answer

Fetching 'https' pages using 'urlopen' vs getpage()

I'm trying to get an 'https' webpage(for eg: https://github.com/twitter/bootstrap) using urlopen(), it returns the page without any problem. But we are evaluating Twisted for a new project and trying to use getPage() to fetch the same page. But…
user845616
1
vote
0 answers

Catching website changes with python using urlopen read function

Hi I am a high school student who has not used python to code programs much, and I was having trouble with creating code to check when a website was updated. I have looked at different resources and I have used them to create what I have but when I…
Zerrai
  • 21
  • 2
1
vote
1 answer

Run code After write function (override) in odoo

I've made a module to run code when Save (write) action is made when editing products (product.template). The purpose is to request an external URL to update this product in my website (a script that updates website using API). The odoo function…
pauet
  • 25
  • 1
  • 8