Hi all, can someone tell me why the read() function in the following
py3 code returns b''?
>>> h = http.client.HTTPConnection("www.twitter.com")
>>> h.connect()
>>> h.request("HEAD", "/", "HTTP 1.0")
>>> r = h.getresponse()
>>> r.read()
b''
Thanks,
Mattia
--
http://mail.python.org/mailman/listi
On 17 Giu, 01:00, Ian Kelly wrote:
> On Thu, Jun 16, 2011 at 4:43 PM, gervaz wrote:
> > Hi all, can someone tell me why the read() function in the following
> > py3 code returns b''?
>
> >>>> h = http.client.HTTPConnection("www.twitter.com")
&
On 17 Giu, 12:14, Adam Tauno Williams wrote:
> On Thu, 2011-06-16 at 15:43 -0700, gervaz wrote:
> > Hi all, can someone tell me why the read() function in the following
> > py3 code returns b''
> > >>> h = http.client.HTTPConnection("www.twitter.com&
Hi all, can you explain me why this simple function works well (i.e. I
can call the print function using txt) in py
>>> def test(value):
... if value%5: txt = "hello"
... else: txt = "test"
... print(txt)
while in other languages like C the txt identifier would be undefined?
Is there
On 21 Giu, 06:06, Ben Finney wrote:
> Chris Angelico writes:
> > On Tue, Jun 21, 2011 at 12:38 PM, Ben Finney
> > wrote:
> > > The *binding* is scoped.
>
> > And the binding follows the exact same rules as anything else would.
> > It has scope and visibility. In terms of the OP, the binding IS
Hi all, is there a way to retrive the function name like with
self.__class__.__name__?
Using self.__dict__.__name__ I've got
>>> def test():
... print(self.__dict__.__name__)
...
>>> test
But I really just want the function name, so 'test'
Any help?
Thanks,
Mattia
--
http://mail.python.
Hi all,
I use a scraper to retrieve data from a web page.
In order to do that I need to enable cookies.
The data that I'm looking for is contained in a bunch of web pages.
Is there a way to show this web pages in a browser using the cookies
used in the script (otherwise it doesn't work).
Thanks,
On 18 Mar, 22:52, Miki Tebeka wrote:
> You can use mechanize, which holds a cookie jar and can user the browser
> cookies as well.
I use:
opener =
urllib.request.build_opener(urllib.request.HTTPCookieProcessor())
urllib.request.install_opener(opener)
I start scraping from http://page.com/home.ht
Hi all,
I've got to download some web pages but I'm behind a proxy. So far
this is what I've used without any successful result receiving the
error: "urllib.error.HTTPError: HTTP Error 407: Proxy Authentication
Required ( The ISA Server requires auth
orization to fulfill the request. Access to the
On 22 Mar, 00:02, Chris Rebert wrote:
> On Mon, Mar 21, 2011 at 2:38 AM, gervaz wrote:
> > Hi all,
> > I've got to download some web pages but I'm behind a proxy. So far
> > this is what I've used without any successful result receiving the
> > erro
On 22 Mar, 09:34, gervaz wrote:
> On 22 Mar, 00:02, Chris Rebert wrote:
>
>
>
>
>
> > On Mon, Mar 21, 2011 at 2:38 AM, gervaz wrote:
> > > Hi all,
> > > I've got to download some web pages but I'm behind a proxy. So far
> > > this
Hi all, I need to find all the address in a html source page, I'm
using:
'href="(?Phttp://mysite.com/[^"]+)">()?(?P[^]+)()?'
but the [^]+ pattern retrieve all the strings not containing <
or / or a etc, although I just not want the word "". How can I
specify: 'do not search the string "blabla"?'
T
On Jan 19, 4:01 pm, Ant wrote:
> A 0-width positive lookahead is probably what you want here:
>
> >>> s = """
>
> ... hdhd http://mysite.com/blah.html";>Test String OK a>
> ...
> ... """>>> p = r'href="(http://mysite.com/[^"]+)">(.*)(?=)'
> >>> m = re.search(p, s)
> >>> m.group(1)
>
> 'http://mysi
On Mar 16, 12:38 am, Graham Breed wrote:
> mattia wrote:
> > I'm using urlopen in order to download some web pages. I've always to
> > replace some characters that are in the url, so I've come up with:
> > url.replace("|", "%7C").replace("/", "%2F").replace(" ", "+").replace
> > (":", "%3A")
> > T
Hi all, I need to fetch some html pages and it is required to have
cookies enabled. So, I'm using
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor
())
urllib.request.install_opener(opener)
as a global instance. Is there a way to always use a default header
like:
{"User-Age
Hi all, is there a pythonic way to have the
--
http://mail.python.org/mailman/listinfo/python-list
Hi all, is there in python the equivalent of the C function int putchar
(int c)? I need to print putchar(8).
Thanks, Mattia
--
http://mail.python.org/mailman/listinfo/python-list
Hi all, given the followin code snippet:
import signal
import time
import sys
import os
print("{0}\n".format(os.getpid()))
ContinueProcessing = True
def stop(signal, frame):
print("\nSignal received!\n")
time.sleep(1)
global ContinueProcessing
ContinueProcessing = False
signal.
Hi all, I need to stop a threaded (using CTR+C or kill) application if
it runs too much or if I decide to resume the work later.
I come up with the following test implementation but I wanted some
suggestion from you on how I can implement what I need in a better or
more pythonic way. Here the code:
Hi all, I would like to ask you how I can use the more efficient join
operation in a code like this:
>>> class Test:
... def __init__(self, v1, v2):
... self.v1 = v1
... self.v2 = v2
...
>>> def prg(l):
... txt = ""
... for x in l:
... if x.v1 is not None:
...
On 31 Dic 2010, 16:43, Emile van Sebille wrote:
> On 12/31/2010 7:22 AM gervaz said...
>
>
>
>
>
> > Hi all, I would like to ask you how I can use the more efficient join
> > operation in a code like this:
>
> >>>> class Test:
> > ... de
On 31 Dic 2010, 23:25, Alice Bevan–McGregor
wrote:
> On 2010-12-31 10:28:26 -0800, John Nagle said:
>
> > Even worse, sending control-C to a multi-thread program
> > is unreliable in CPython. See "http://blip.tv/file/2232410";
> > for why. It's painful.
>
> AFIK, that has been resolved in Python
On 2 Gen, 19:14, Emile van Sebille wrote:
> On 1/2/2011 9:43 AM gervaz said...
>
>
>
>
>
> > On 31 Dic 2010, 16:43, Emile van Sebille wrote:
> >> On 12/31/2010 7:22 AM gervaz said...
>
> >>> Hi all, I would like to ask you how I can use the more ef
On 2 Gen, 22:37, gervaz wrote:
> On 2 Gen, 19:14, Emile van Sebille wrote:
>
>
>
>
>
> > On 1/2/2011 9:43 AM gervaz said...
>
> > > On 31 Dic 2010, 16:43, Emile van Sebille wrote:
> > >> On 12/31/2010 7:22 AM gervaz said...
>
> > &
On 3 Gen, 17:47, de...@web.de (Diez B. Roggisch) wrote:
> gervaz writes:
> > On 31 Dic 2010, 23:25, Alice Bevan–McGregor
> > wrote:
> >> On 2010-12-31 10:28:26 -0800, John Nagle said:
>
> >> > Even worse, sending control-C to a multi-thread program
>
On 3 Gen, 22:17, Adam Skutt wrote:
> On Jan 3, 4:06 pm, Jean-Paul Calderone
> wrote:
>
>
>
> > > Multiple processes, ok, but then regarding processes' interruption
> > > there will be the same problems pointed out by using threads?
>
> > No. Processes can be terminated easily on all major platfo
On 4 Gen, 07:13, Jean-Paul Calderone
wrote:
> On Jan 3, 6:17 pm, Adam Skutt wrote:
>
> > On Jan 3, 5:24 pm, Jean-Paul Calderone
> > wrote:
>
> > > Of course. The whole point here is not about threads vs processes.
> > > It's about shared memory concurrency vs non-shared memory
> > > concurrency
27 matches
Mail list logo