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
1
vote
1 answer

why urlopen timeout in eventlet spawn function

I met a strange question: eventlet.green.urllib2.urlopen() raise HTTP Error 408: Request Timeout. but successfully if open the "# eventlet.green.time.sleep(0.1)" do anybody know why? thanks a lot! test.py: import eventlet import…
1
vote
1 answer

Scraping the second page of a website in Python does not work

Let's say I want to scrape the data here. I can do it nicely using urlopen and BeautifulSoup in Python 2.7. Now if I want to scrape data from the second page with this address. What I get is the data from the first page! I looked at the page source…
TJ1
  • 7,578
  • 19
  • 76
  • 119
1
vote
0 answers

Python 3.4 using urlopen to get web content via proxy

Using the example below i am trying to get web conents from behind a proxy server but so far am unsuccessful. proxies = {'http': 'http://proxy:8080'} from urllib.request import urlopen with urlopen('http://sixty-north.com/c/t.txt', proxies) as…
forbzie
  • 191
  • 1
  • 5
1
vote
0 answers

Python how to use "urlopen" open a fluid layout web page?

I can use urllib2.urlopen to get a static web page context, but it can not open a fluid layout web page. How can I get a fluid layout web page using urlopen or something else in Python?
Jerry Zhang
  • 1,198
  • 1
  • 17
  • 36
1
vote
0 answers

Python - How to open urls (html files) which are located on an internal network with urlopen?

The addresses I am trying to open look like this: "//usa-qa/QAEngr/QA_Team_VSripathi/Negar/Help files/broken/header_test/main.htm" They are located on a company's internal network. I tried this piece of code: import urllib import…
na1368
  • 127
  • 9
1
vote
3 answers

How to handle redirects in url opener

Sorry for rookie question. I was wondering if there is an efficient url opener class in python that handle redirects. I'm currently using simple urllib.urlopen() but It's not working. This is an example: http://thetechshowdown.com/Redirect4.php For…
user3821329
  • 317
  • 1
  • 6
  • 14
1
vote
1 answer

Python urlopen IOError: [Errno socket error] [Errno 10060]

I'm looking to get more information about IOError: [Errno socket error] [Errno 10060] when using urlopen in Python 2.7. I am using my personal 35MB/s Internet connection (no proxy). I've been opening multiple webpages from various websites using a…
LaGuille
  • 1,658
  • 5
  • 20
  • 37
1
vote
2 answers

Extract javascript information from url with python

I have a URL that links to a javascript file, for example http://something.com/../x.js. I need to extract a variable from x.js Is it possible to do this using python? At the moment I am using urllib2.urlopen() but when I use .read() I get this…
EasilyBaffled
  • 3,822
  • 10
  • 50
  • 87
1
vote
1 answer

Slow urllib.urlopen with wired internet connection (to local server)

I have the following /etc/hosts 127.0.0.1 my-server-name Then I run this code: import urllib2 f = urllib2.urlopen('http://my-server-name') print f.read() If I’m connected to the interned via wifi (or if the Ethernet interface is off), the…
fsiddi
  • 101
  • 6
1
vote
1 answer

Python urlopen error 404 directories

I have this code : from urllib.request import urlopen from bs4 import BeautifulSoup page = urlopen("http://www.doctoralia.com") soup = BeautifulSoup(page) myfile = open('data.txt','w') myfile.write(soup.prettify()) myfile.close() print('done boy…
Melki
  • 579
  • 2
  • 5
  • 26
1
vote
0 answers

why can not get urllib2.urlopen?

Why can't I get urlopen to work? import urllib2 DOI = '10.1016/j.trf.2005.10.001' link1 = "http://dx.doi.org/" + DOI print link1 arnumber = urllib2.urlopen(link1) print arnumber I receive this error: URLError:
1
vote
1 answer

Querying web pages with Python

I am learning web programming with Python, and one of the exercises I am working on is the following: I am writing a Python program to query the website "orbitz.com" and return the lowest airfare. The departure and arrival cities and dates are used…
Aravind
  • 11
  • 1
  • 2
1
vote
0 answers

urllib.error.HTTPError: HTTP Error 405: Not Allowed

import urllib.request url = 'http://www.oddsportal.com/ajax-next-games/1/0/1/20130820/' print(url) page = urllib.request.urlopen(url) print(page) Any idea why this script gives an error code "urllib.error.HTTPError: HTTP Error 405: Not Allowed"…
1
vote
1 answer

urlopen trouble while trying to download a gzip file

I am going to use the wiktionary dump for the purpose of POS tagging. Somehow it gets stuck when downloading. Here is my code: import nltk from urllib import urlopen from collections import Counter import gzip url =…
Alex
  • 11
  • 5
1
vote
1 answer

Python Printing A List Issue

I'm really struggling to work out how to print to a list. I'd like to print the server response codes of URLs I specify. Do you know how I'd alter to code to print the output into a list? If not, do you know where I'd find the answer? I've been…
Sam Perry
  • 2,554
  • 3
  • 28
  • 29