Re: Repeatedly crawl website every 1 min

2017-05-11 Thread Iuri
Unless you are authorized, don't do it. It literally costs a lot of money to the website you are crawling, in CPU and bandwidth. Hundreds of concurrent requests can even kill a small server (with bad configuration). Look scrapy package, it is great for scraping, but be friendly with the websites

Re: Horizontal Scalability in python

2015-09-15 Thread Iuri
You can do it with nginx. Tornado has some docs about it: http://tornado.readthedocs.org/en/latest/guide/running.html#running-behind-a-load-balancer Also, nginx has extensive documentation about the topic; https://www.nginx.com/resources/admin-guide/load-balancer/ Cheers! On Tue, Sep 15, 2015 a

Re: SQLAlchemy - web framework ?

2014-05-12 Thread Iuri
I don't know what exactly you mean with "wanted to not build it all myself", but Flask is great with SQLAlchemy. You have the Flask-SQLAlchemy extension and it has a lot of other integrations, like Flask-Admin. You don't have to fear flask to bigger projects. To be honest, I prefer it instead of D

Re: Is It Bug?

2013-12-07 Thread Iuri
This way, it will replace '\' with '\', so nothing change. >>> 'Hello, World'.replace('', '\\') 'Hello, \\World' >>> print 'Hello, World'.replace('', '\\') Hello, \World On Sat, Dec 7, 2013 at 10:58 PM, Mahan Marwat wrote: > Why this is not working. > > >>> 'Hello, World'.r

imp.load_module error in Python 3.3

2013-02-11 Thread Iuri
I want to load a file with an invalid module name (with a dash). filename = '...' # something like /my/path/to/ejtp-crypto with open(filename, 'rb') as fp: my_module = imp.load_module('crypto', fp, 'ejtp-crypto', ('.py', 'rb', imp.PY_SOURCE)) It works to all Python >= 2.5, except

Re: _mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host

2012-08-15 Thread Iuri
MySQLdb.connect does not accept a "connection string" parameter. On Wed, Aug 15, 2012 at 11:53 AM, nepaul wrote: > 在 2012年8月15日星期三UTC+8下午10时23分24秒,Mark Lawrence写道: > > On 15/08/2012 14:30, nepaul wrote: > > > > > The code: > > > > > import MySQLDB > > > > > strCmd = "user = 'root', passwd = '123

Re: To start a simple server

2011-10-03 Thread Iuri
Something is running in your port 8080. Change the port and try again. On Mon, Oct 3, 2011 at 3:15 PM, Amelia T Cat wrote: > On Mon, 03 Oct 2011 10:09:59 -0700, sillyou su wrote: > > > 啊!! > > > > I should use 127.0.0.1 instance of 0.0.0.0 > > Theoretically either one should be fine. If you use

Re: program organization question for web development with python

2010-09-16 Thread Iuri
Another pretty web framework is Bottle (http://bottle.paws.de). It is very easy to setup and use. I use it to tasks like this one you want. []s iuri On Thu, Sep 16, 2010 at 3:01 PM, MRAB wrote: > On 16/09/2010 18:19, Hans wrote: > >> On Sep 15, 5:33 pm, James Mills wrote: >&g

Re: compile() error

2010-05-19 Thread Iuri
understanded about Benjamin's answer is compile() without a new line at the end has an indetermined behaviour, so in some cases it works. Iuri de Silvio On Wed, May 19, 2010 at 9:52 PM, Steven D'Aprano < steve-remove-t...@cybersource.com.au> wrote: > On Wed, 19 May 2010 22:31:31 +00

Re: compile() error

2010-05-19 Thread Iuri
Thanks, Benjamin. I used Python 2.6 to these tests. []s iuri On Wed, May 19, 2010 at 7:31 PM, Benjamin Peterson wrote: > Iuri gmail.com> writes: > > Any ideas about what is happening? > > Until Python 2.7/3.2, compile() does't like sources which don't end in a

compile() error

2010-05-19 Thread Iuri
ent call last): File "", line 1, in File "", line 2, in cptest File "test_file.py", line 3 #end ^ SyntaxError: invalid syntax I guess these commands explain the problem. Any ideas about what is happening? Regards, iuri -- http://mail.python.org/mailman/listinfo/python-list

Re: def method with variable no of parameters file.writeStuff(n, a1, a2, ...an)

2010-04-04 Thread Iuri
What you need is var-args: def func(*args): for arg in args: print arg func(1,2,3,4) On Fri, Apr 2, 2010 at 8:25 AM, vlad_fig wrote: > Hello all, > > I would like some help with setting up a method that would allow me to > change its number of parameters. For example: > > #

Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread Iuri
I tested it in Windows Vista. When I type single or double quotes, I get a unicode character, different of python's quotes, and it break my code. But i liked this tool! Thanks! []s iuri On Sun, Feb 21, 2010 at 3:13 PM, Chris Colbert wrote: > This is bloody fantastic! I must say, th

Re: Sikuli: the coolest Python project I have yet seen...

2010-01-26 Thread Iuri
I liked this tool! I'm thinking about how I can write acceptance tests with Sikuli. []s iurisilvio On Tue, Jan 26, 2010 at 7:49 AM, Jean-Michel Pichavant < jeanmic...@sequans.com> wrote: > Terry Reedy wrote: > >> On 1/25/2010 9:14 AM, Javier Collado wrote: >> >> I think the site is under mainte

Re: Something More Elegant

2010-01-09 Thread Iuri
And you should use cursor.fetchall() instead of cursor in list comprehension: packageIDs = [itm[0] for itm in cursor.fetchall()] On Sat, Jan 9, 2010 at 1:01 PM, Gabriel Genellina wrote: > En Sat, 09 Jan 2010 11:01:25 -0300, Victor Subervi < > victorsube...@gmail.com> escribió: > >> On Sat, Jan 9

Re: Something More Elegant

2010-01-09 Thread Iuri
Your code select some ids from database and list distinct ids in packageIDs. You can use SELECT DISTINCT in your SQL statement. On Sat, Jan 9, 2010 at 11:23 AM, Victor Subervi wrote: > Hi; > The following code works fine. I would like you to suggest something more > simple and elegant: > >

Re: Converting a float to a formatted outside of print command

2009-11-23 Thread Iuri
You forgot a % simbol in your string: y = 0.5 x = '*%*.1f' % y []s iurisilvio On Mon, Nov 23, 2009 at 7:15 PM, stephen_b wrote: > I'd like to convert a list of floats to formatted strings. The > following example raises a TypeError: > > y = 0.5 > x = '.1f' % y > -- > http://mail.python.org/mai

Re: help wanted with list

2009-09-24 Thread Iuri
You should use a dictionary. dic = {'a':1, 'b':2} Use dic['a'] to get output 1. []s iurisilvio On Thu, Sep 24, 2009 at 5:31 PM, Ahmed Shamim wrote: > list = [ 'a', '1', 'b', '2'] > what would be the logic, if I input a to get output 1. > -- > http://mail.python.org/mailman/listinfo/python-lis

Re: regexp help

2009-08-27 Thread Iuri
You can use r"[+-]?\d+" to get positive and negative integers. It returns true to these strings: "+123", "-123", "123" On Thu, Aug 27, 2009 at 3:15 PM, Bakes wrote: > If I were using the code: > > (?P[0-9]+) > > to get an integer between 0 and 9, how would I allow it to register > negative in