urllib Questions

5

Solved

I have a program that uses urllib to periodically fetch a url, and I see intermittent errors like : I/O error(socket error): [Errno 111] Connection refused. It works 90% of the time, but the ot...
Cruce asked 1/4, 2010 at 7:28

6

Solved

Here, http://www.ffiec.gov/census/report.aspx?year=2011&state=01&report=demographic&msa=11500 There is a table. My goal is to extract the table and save it to a csv file. I wrote a ...
Cheng asked 11/5, 2012 at 17:33

5

Solved

How do I check to see if urllib.urlretrieve(url, file_name) has completed before allowing my program to advance to the next statement? Take for example the following code snippet: import tracebac...
Brace asked 21/7, 2012 at 19:1

1

I am trying to fetch a page and urlopen hangs and never returns anything, although the web page is very light and can be opened with any browser without any problems import urllib.request with url...
Necromancy asked 15/5, 2017 at 19:33

1

Solved

I tried requesting an RSS feed on Treasury Direct using Python. In the past I've used urllib, or requests libraries to serve this purpose and it's worked fine. This time however, I continue to get ...
Whitton asked 23/4, 2017 at 4:25

4

Solved

I want to open a url using urllib.request.urlopen('someurl'): with urllib.request.urlopen('someurl') as url: b = url.read() I keep getting the following error: urllib.error.HTTPError: HTTP Erro...
Montgomery asked 15/6, 2014 at 5:18

3

Solved

I am trying to build a url so that I can send a get request to it using urllib module. Let's suppose my final_url should be url = "www.example.com/find.php?data=http%3A%2F%2Fwww.stackoverflow.co...
Tillo asked 26/5, 2012 at 11:8

1

Solved

I don't know why my code is returning this error, I can't seem to debug it. TypeError: expected string or bytes-like object Here is what I'm using to download self.headers = { 'Accept': 'text/ht...
Maebashi asked 25/3, 2017 at 22:14

3

Solved

I'm trying to open a local file using urllib2. How can I go about doing this? When I try the following line with urllib: resp = urllib.urlopen(url) it works correctly, but when I switch it to: ...
Muscatel asked 13/12, 2013 at 3:29

2

My problem is with error handling of the python urllib error object. I am unable to read the error message while still keeping it intact in the error object, for it to be consumed later. response ...
Janettejaneva asked 11/11, 2015 at 21:27

4

Solved

I'm slamming my head against the wall with this one. I've been trying every example, reading every last bit I can find online about basic http authorization with urllib2, but I can not figure out w...
Glider asked 3/2, 2011 at 5:46

3

Solved

When I try to follow the Python Wiki's example related to URL encoding: >>> import urllib >>> params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0}) >>> f = urlli...
Spectrohelioscope asked 6/3, 2015 at 20:13

7

Solved

I've got a piece of code that I can't figure out how to unit test! The module pulls content from external XML feeds (twitter, flickr, youtube, etc.) with urllib2. Here's some pseudo-code for it: p...
Glaive asked 16/2, 2010 at 22:2

3

We're trying to write a script with python (using python-requests a.t.m.) to do a POST request to a site where the content has to be MultipartFormData. When we do this POST request manually (by fi...
Sweepstake asked 7/8, 2013 at 12:41

1

Solved

I'm working on a lesson from Udacity and am having some issue trying to find out if the result from this site returns true or false. I get the TypeError with the code below. from urllib.request i...
Hybridism asked 24/10, 2016 at 5:42

4

I am downloading a compressed file from the internet: with lzma.open(urllib.request.urlopen(url)) as file: for line in file: ... After having downloaded and processed a a large part of the fil...
Pyemia asked 1/4, 2015 at 8:39

2

I have a long running python script, launched with upstart. This script makes quite a lot of requests. Everything works well at first, however after a few hours I start permanently getting the foll...
Touchstone asked 26/12, 2011 at 8:45

4

Solved

How to get the code of the headers through urllib?
Neona asked 13/11, 2009 at 0:35

3

Solved

I want to download image file from a url using python module "urllib.request", which works for some website (e.g. mangastream.com), but does not work for another (mangadoom.co) receiving error "HTT...
Heavyfooted asked 9/1, 2016 at 9:52

3

I am trying to do this Matasano crypto challenge that involves doing a timing attack against a server with an artificially slowed-down string comparison function. It says to use "the web framework ...

3

Solved

I receive a 'HTTP Error 500: Internal Server Error' response, but I still want to read the data inside the error HTML. With Python 2.6, I normally fetch a page using: import urllib2 url = "http:/...
Octans asked 10/2, 2010 at 0:55

2

I am trying to use BeautifulSoup to extract the contents from a website (http://brooklynexposed.com/events/). As an example of the problem I can run the following code: import urllib import bs4 as...
Rosecan asked 15/7, 2013 at 17:25

3

Solved

Hi I'm reading "Web Scraping with Python (2015)". I saw the following two ways of opening url, with and without using .read(). See bs1 and bs2 from urllib.request import urlopen from bs4 import Be...
Septi asked 8/3, 2016 at 9:30

2

Solved

So, My code is only 4 lines. I am trying to connect to a website, what I am trying to do after that is irrelevant because the error arised without the other codes. import urllib.request from bs4 ...
Gabey asked 7/3, 2016 at 3:37

1

Solved

I was getting the following error initially when I was trying to run the code below- Error:-the JSON object must be str, not 'bytes' import urllib.request import json search = '230 boulder lane ...
Because asked 6/2, 2016 at 19:28

© 2022 - 2024 — McMap. All rights reserved.