Re: urllib2

2012-03-15 Thread Ovnicraft
On Tue, Mar 13, 2012 at 8:54 PM, hack <scottma...@gmail.com> wrote: > This stuff is killing me. LOL I think I just don't understand the > urllib2 yet. > > I'm trying something very simple, but am having a terrible time > figuring out how to get it to work in python an

Re: urllib2

2012-03-15 Thread Alec Taylor
Also, quick sort-of side-note: I recommend checking out the python-requests library as an alternative to urllib2 http://docs.python-requests.org -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to dj

Re: urllib2

2012-03-15 Thread Bill Freeman
Are you using the development server? If so, how about sticking a pdb.set_trace() at line 510 of /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py to see what you're really getting? On 3/13/12, hack <scottma...@gmail.com> wrote: > Yes, I added @cs

Re: urllib2

2012-03-13 Thread hack
Yes, I added @csrf_exempt and not I get a 500 error instead. I'm not sure what the deal is. On Tuesday, March 13, 2012 10:09:37 PM UTC-4, Matt Schinckel wrote: > > That response indicates you do not have permission to access that resource > on that server. Are you sure you are hitting the

Re: urllib2

2012-03-13 Thread hack
Hmmm, perhaps this might help: @csrf_exempt On Tuesday, March 13, 2012 9:54:30 PM UTC-4, hack wrote: > > This stuff is killing me. LOL I think I just don't understand the > urllib2 yet. > > I'm trying something very simple, but am having a terrible time > figuring out how

Re: urllib2

2012-03-13 Thread Matt Schinckel
That response indicates you do not have permission to access that resource on that server. Are you sure you are hitting the correct URL? You may want to look into requests, it is a nicer interface for interacting with http servers. Matt. -- You received this message because you are

urllib2

2012-03-13 Thread hack
This stuff is killing me. LOL I think I just don't understand the urllib2 yet. I'm trying something very simple, but am having a terrible time figuring out how to get it to work in python and django. All I want to do is post to my site with params. Here is what I have: def test(request

Re: get Django url content with urllib2

2011-08-11 Thread Daniel Roseman
On Thursday, 11 August 2011 09:20:41 UTC+1, Igor Nemilentsev wrote: > > Hello everyone. > > I try: > > content = urllib2.urlopen('http://localhost:8080/').read() > > from inside some Django view(function) > and http://localhost:8080/ is same Django server. > >

get Django url content with urllib2

2011-08-11 Thread Igor Nemilentsev
Hello everyone. I try: content = urllib2.urlopen('http://localhost:8080/').read() from inside some Django view(function) and http://localhost:8080/ is same Django server. This command do not give me any answer but hang on. But if url is foreign it is working. Is there some cycle problem

Re: How do I authenticate a urllib2 script in order to access HTTPS web services from a Django site?

2011-02-23 Thread carl
ews that are meant to function like RESTful web services. > > I'm now in the process of writing a script that uses urllib/urllib2 to > contact several of these services in order to download a series of > very large files. I'm running into problems with 403: FORBIDDEN errors > wh

How do I authenticate a urllib2 script in order to access HTTPS web services from a Django site?

2011-02-22 Thread carl
and responses. All views are written to redirect if the user isn't authenticated. It also has several views that are meant to function like RESTful web services. I'm now in the process of writing a script that uses urllib/urllib2 to contact several of these services in order to download a series of very

Re: I get an error when I used urllib2.urlopen() to open a remote file in a ftp server

2011-01-07 Thread DaithiF
Hi, you only have 1 forward slash after the ftp: protocol string, you need two: 'ftp:*/*/16.168.250.14:2189/RTVE/VIDEOS/Thisisit.wmv' -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: I get an error when I used urllib2.urlopen() to open a remote file in a ftp server

2011-01-07 Thread Scott Hebert (slaptijack)
>         file = 'ftp:/16.168.250.14:2189/RTVE/VIDEOS/Thisisit.wmv' Looks like you are missing a second slash before the IP address there. file = 'ftp://16.168.250.14:2189/RTVE/VIDEOS/Thisisit.wmv' -- Scott Hebert http://slaptijack.com/ -- You received this message because you are subscribed

I get an error when I used urllib2.urlopen() to open a remote file in a ftp server

2011-01-06 Thread Ariel
Hi everybody: I get an error when I used urllib2.urlopen() to open a remote file in a ftp server, what I am trying to do is to make a view to force the browser to download a file to disk instead of playing or displaying it. My code is the following: file = 'ftp:/16.168.250.14:2189/RTVE

Re: Help:How to post data to the admin form by urllib2 ?

2010-07-28 Thread Benedict Verheyen
On 27/07/2010 17:48, jerry wrote: > Hi: > I build a website and want to login the admin form by python code. I > have disabled the CSRF in my project and use urllib2 to post data. > here

Re: Help:How to post data to the admin form by urllib2 ?

2010-07-28 Thread Rory Hart
On Wed, Jul 28, 2010 at 1:48 AM, jerry <jerryzhou2...@gmail.com> wrote: > Hi: > I build a website and want to login the admin form by python code. I > have disabled the CSRF in my project and use urllib2 to post data. >

Help:How to post data to the admin form by urllib2 ?

2010-07-27 Thread jerry
Hi: I build a website and want to login the admin form by python code. I have disabled the CSRF in my project and use urllib2 to post data. here are my codes: import urllib import

Re: urllib2: post request to a django form

2010-04-14 Thread bfrederi
= { 'Referer': "http://%s/comments/; % (current_site.domain), } #Create the request req = urllib2.Request(url, data, headers) #Send the request response = urllib2.urlopen(req) And I made my receiving view more forgiving: referrer = request.META.get('HTTP_REFERER', 'None') Thanks! -Brandon --

Re: urllib2: post request to a django form

2010-04-13 Thread Ian Lewis
t to a django form using > urllib2.urlopen. I'm on revision 12523 of django trunk, so I used the > @csrf_exempt decorator for the view that receives the post. When I > tried to post to the form, it would return a 500 error, and not log > the error in apache's error log for some reason. So I

urllib2: post request to a django form

2010-04-13 Thread bfrederi
urllib2.urlopen. I'm on revision 12523 of django trunk, so I used the @csrf_exempt decorator for the view that receives the post. When I tried to post to the form, it would return a 500 error, and not log the error in apache's error log for some reason. So I decided to have my receiving view return

Re: urllib2.open failing in Django?

2006-02-20 Thread Malcolm Tredinnick
; connection handlers, logging tools and god knows what will never have > the same expectations as to how the sockets should behave. > I didn't find a way to set a timeout for a specific connection when > using urllib, urllib2 or even httplib - in python 2.3. > So I ended

Re: urllib2.open failing in Django?

2006-02-20 Thread Jakub Labath
will never have the same expectations as to how the sockets should behave. I didn't find a way to set a timeout for a specific connection when using urllib, urllib2 or even httplib - in python 2.3. So I ended up using raw sockets :-( because then it is possible to set a custom timeout without

Re: urllib2.open failing in Django?

2006-02-20 Thread Ned Batchelder
The value was 20 (the unit is seconds). With the function call removed, the calls completed successfully in much less time than 20 seconds, on the order of 1 second, so I don't thing the timeout was actually kicking in. --Ned. --~--~-~--~~~---~--~~ You received

Re: urllib2.open failing in Django?

2006-02-20 Thread Tom Tobin
On 2/20/06, Ned Batchelder <[EMAIL PROTECTED]> wrote: > > I found the problem on my end. It was a call to > socket.setdefaulttimeout(). The bug I had found but can't locate now > was correct: if you call that socket function, urllib2 (and httplib) > have very difficult t

Re: urllib2.open failing in Django?

2006-02-20 Thread Ned Batchelder
I found the problem on my end. It was a call to socket.setdefaulttimeout(). The bug I had found but can't locate now was correct: if you call that socket function, urllib2 (and httplib) have very difficult times completing reads. I took out my call to setdefaulttimeout, and now it works great

Re: urllib2.open failing in Django?

2006-02-20 Thread Amit Upadhyay
On 2/20/06, Ned Batchelder <[EMAIL PROTECTED]> wrote: I have some code in a Django view that makes a request on anotherserver.  It uses urllib2 to make an SSL connection to the server andrequest a page.  Here's the code:I dont know about https, but I am doing a lot of fetching page ove

urllib2.open failing in Django?

2006-02-20 Thread Ned Batchelder
I have some code in a Django view that makes a request on another server. It uses urllib2 to make an SSL connection to the server and request a page. Here's the code: authb64 = ('%s:%s' % (username, password)).encode('base64').strip() req = urllib2.Request('https://'+url