From anand21nanda at gmail.com Tue Jul 1 09:28:28 2014 From: anand21nanda at gmail.com (Anand Reddy Pandikunta) Date: Tue, 1 Jul 2014 12:58:28 +0530 Subject: [BangPypers] Django FTP Message-ID: Hi, In one Django App, I've created a simple form. It has URLField, where user enters FTP url. As soon as user submits the form, I have to download the file and save it our servers. File size: ~10gb. Need to download securely. I am new to Django. Any help/resources is highly appreciated. Thank You! -- - Anand Reddy Pandikunta www.avilpage.com www.quotes160.com From gora at mimirtech.com Tue Jul 1 09:36:04 2014 From: gora at mimirtech.com (Gora Mohanty) Date: Tue, 1 Jul 2014 13:06:04 +0530 Subject: [BangPypers] Django FTP In-Reply-To: References: Message-ID: On 1 July 2014 12:58, Anand Reddy Pandikunta wrote: > > Hi, > > In one Django App, I've created a simple form. It has URLField, where user > enters FTP url. As soon as user submits the form, I have to download the > file and save it our servers. File size: ~10gb. Need to download securely. Use ftplib to download the file. It is not completely clear what you mean by "download securely", but ftplib will handle ftps. If you need sftp, i.e., ftp over SSH, use paramiko. You should also use an offline task processor like Celery, rather than trying to download a 10GB file in a web request. Regards, Gora From arunvr at gmail.com Tue Jul 1 09:44:10 2014 From: arunvr at gmail.com (Arun Ravindran) Date: Tue, 1 Jul 2014 13:14:10 +0530 Subject: [BangPypers] Django FTP In-Reply-To: References: Message-ID: Hi Anand, Tasks which take significant time such as downloading a file should be kept out of the normal request-response processing. I suggest using an asynchronous task queue like Celery for this. Once the form is found to be valid, you can start a Celery task to download. When the download completes you can inform the user by email or a polling web page. Regards, Aryn On Tue, Jul 1, 2014 at 12:58 PM, Anand Reddy Pandikunta < anand21nanda at gmail.com> wrote: > Hi, > > In one Django App, I've created a simple form. It has URLField, where user > enters FTP url. As soon as user submits the form, I have to download the > file and save it our servers. File size: ~10gb. Need to download securely. > > I am new to Django. Any help/resources is highly appreciated. Thank You! > > -- > - Anand Reddy Pandikunta > www.avilpage.com > www.quotes160.com > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > https://mail.python.org/mailman/listinfo/bangpypers > From veraks18 at gmail.com Tue Jul 1 12:19:33 2014 From: veraks18 at gmail.com (Akshay Verma) Date: Tue, 1 Jul 2014 15:49:33 +0530 Subject: [BangPypers] Web Page request analysis using Python Message-ID: Hi, I am currently using Python 3. I have made a basic program which fetches HTML response from a URL and then parses it to get JS, CSS (using tinyCss2) and Image GET Requests URLs that the page should make to display properly. Problem here is that I am not able to get/locate all the requests as some requests are done by executing JS code. Could anyone suggest how to go ahead or a better approach? Best Regards, Akshay Verma. From arunvr at gmail.com Tue Jul 1 14:34:23 2014 From: arunvr at gmail.com (Arun Ravindran) Date: Tue, 1 Jul 2014 18:04:23 +0530 Subject: [BangPypers] Web Page request analysis using Python In-Reply-To: References: Message-ID: Hi Akshay, It seems that you need to scrape the webpages and execute the JavaScript somehow. There are several solutions to this. A simple approach is to use the Chrome Inspector and copy the URLs being accessed by JavaScript. Another approach will be to use a headless browser like PhantomJS using Selenium or use Selenium alone as explained in this tutorial . Again, all this might fail if the Javascript content is truly dynamic like a serverside token. So, good luck! :) Cheers, Arun On Tue, Jul 1, 2014 at 3:49 PM, Akshay Verma wrote: > Hi, > > I am currently using Python 3. I have made a basic program which fetches > HTML response from a URL and then parses it to get JS, CSS (using tinyCss2) > and Image GET Requests URLs that the page should make to display properly. > > Problem here is that I am not able to get/locate all the requests as some > requests are done by executing JS code. Could anyone suggest how to go > ahead or a better approach? > > Best Regards, > Akshay Verma. > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > https://mail.python.org/mailman/listinfo/bangpypers > From anand21nanda at gmail.com Wed Jul 2 09:15:39 2014 From: anand21nanda at gmail.com (Anand Reddy Pandikunta) Date: Wed, 2 Jul 2014 12:45:39 +0530 Subject: [BangPypers] Django FTP In-Reply-To: References: Message-ID: @Gora Mohanty @Arun Ravindran Thanks for the help. Task completed. FTP + Celery + Django = Asynchronously Awesome!! On Tue, Jul 1, 2014 at 1:14 PM, Arun Ravindran wrote: > Hi Anand, > > Tasks which take significant time such as downloading a file should be kept > out of the normal request-response processing. I suggest using an > asynchronous task queue like Celery for > this. Once the form is found to be valid, you can start a Celery task to > download. When the download completes you can inform the user by email or a > polling web page. > > Regards, > Aryn > > > On Tue, Jul 1, 2014 at 12:58 PM, Anand Reddy Pandikunta < > anand21nanda at gmail.com> wrote: > > > Hi, > > > > In one Django App, I've created a simple form. It has URLField, where > user > > enters FTP url. As soon as user submits the form, I have to download the > > file and save it our servers. File size: ~10gb. Need to download > securely. > > > > I am new to Django. Any help/resources is highly appreciated. Thank You! > > > > -- > > - Anand Reddy Pandikunta > > www.avilpage.com > > www.quotes160.com > > _______________________________________________ > > BangPypers mailing list > > BangPypers at python.org > > https://mail.python.org/mailman/listinfo/bangpypers > > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > https://mail.python.org/mailman/listinfo/bangpypers > -- - Anand Reddy Pandikunta www.avilpage.com www.quotes160.com From modi.konark at gmail.com Mon Jul 7 18:19:07 2014 From: modi.konark at gmail.com (konark modi) Date: Mon, 7 Jul 2014 21:49:07 +0530 Subject: [BangPypers] Anyone Travelling for EuroPython ? Message-ID: Hi Wanted to know if anyone on the list is planning to travel for EuroPython 2014 this July. Regards Konark From anand21nanda at gmail.com Tue Jul 8 09:43:02 2014 From: anand21nanda at gmail.com (Anand Reddy Pandikunta) Date: Tue, 8 Jul 2014 13:13:02 +0530 Subject: [BangPypers] Django - Infinte Loop Message-ID: Hi, *models.py* *def my_func(sender, instance, created, **kwargs):* * # do something* * instance.status = 'task completed'* * instance.save()* *class MyModel(models.Model):* * status = models.CharField(max_length=100, blank=True)* * # some code* *signals.post_save.connect(my_func, sender=MyModel)* I am using post_save signal to connect to a function. If a new instance of model is saved, post_save signal connects to my_func. Once the function is executed, I am updating status of the model. This is again sending post_save signal which is leading to infinite loop. I want to execute my_func only once and update status many times. Does any one know how to do this? -- - Anand Reddy Pandikunta www.avilpage.com www.quotes160.com From kracethekingmaker at gmail.com Tue Jul 8 09:57:09 2014 From: kracethekingmaker at gmail.com (kracekumar ramaraju) Date: Tue, 8 Jul 2014 13:27:09 +0530 Subject: [BangPypers] Django - Infinte Loop In-Reply-To: References: Message-ID: Hi Anand I would save *don't* use Django signal. Signals are hard to test and don't know when they will be executed. Suggestions - If post_save function does some work like updating external service which can take data, use rq or celery. - You can override django save. class MyModel(BaseClass): def save(self, **kwargs) # set all attributes # call super class save # call function here - blocking call. On Tue, Jul 8, 2014 at 1:13 PM, Anand Reddy Pandikunta < anand21nanda at gmail.com> wrote: > Hi, > > *models.py* > > *def my_func(sender, instance, created, **kwargs):* > * # do something* > * instance.status = 'task completed'* > * instance.save()* > > *class MyModel(models.Model):* > * status = models.CharField(max_length=100, blank=True)* > * # some code* > > *signals.post_save.connect(my_func, sender=MyModel)* > > > I am using post_save signal to connect to a function. > > If a new instance of model is saved, post_save signal connects to my_func. > Once the function is executed, I am updating status of the model. > This is again sending post_save signal which is leading to infinite loop. > > I want to execute my_func only once and update status many times. > Does any one know how to do this? > > > -- > - Anand Reddy Pandikunta > www.avilpage.com > www.quotes160.com > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > https://mail.python.org/mailman/listinfo/bangpypers > -- *Thanks & Regardskracekumar"Talk is cheap, show me the code" -- Linus Torvaldshttp://kracekumar.com * From navin.kabra at gmail.com Tue Jul 8 12:15:03 2014 From: navin.kabra at gmail.com (Navin Kabra) Date: Tue, 08 Jul 2014 15:45:03 +0530 Subject: [BangPypers] Django - Infinte Loop In-Reply-To: References: Message-ID: <867g3orwbc.fsf@smriti.com> 1. Why are you doing this using a signal? Signals are best used when saving of Model1 needs to trigger some action on Model2. If you want to modify Model1 itself, you're better off doing this inside MyModel::save 2. If you really want to do it this way, put an if condition in my_func so that instance.save() is called only the first time. It is hard to give details without knowing the reason why you're doing this. But something like this would work: def my_func(sender, instance, created, **kwargs): if instance.status == 'task completed': return # do something instance.status = 'task completed' instance.save() Or even something like this: def my_func(sender, instance, created, **kwargs): try: if instance.in_signal: return except AttributeError: instance.in_signal = True # do something instance.status = 'task completed' instance.save() Anand Reddy Pandikunta writes: > Hi, > > *models.py* > > *def my_func(sender, instance, created, **kwargs):* > * # do something* > * instance.status = 'task completed'* > * instance.save()* > > *class MyModel(models.Model):* > * status = models.CharField(max_length=100, blank=True)* > * # some code* > > *signals.post_save.connect(my_func, sender=MyModel)* > > > I am using post_save signal to connect to a function. > > If a new instance of model is saved, post_save signal connects to my_func. > Once the function is executed, I am updating status of the model. > This is again sending post_save signal which is leading to infinite loop. > > I want to execute my_func only once and update status many times. > Does any one know how to do this? > > > -- > - Anand Reddy Pandikunta > www.avilpage.com > www.quotes160.com > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > https://mail.python.org/mailman/listinfo/bangpypers From nitin.nitp at gmail.com Tue Jul 8 14:40:06 2014 From: nitin.nitp at gmail.com (Nitin Kumar) Date: Tue, 8 Jul 2014 18:10:06 +0530 Subject: [BangPypers] Test python interpreter Message-ID: Hi All, We will have instrumented python in our proprietary OS. Is their a way/tool to test the basic functionality of Python. Nitin K From pratikmandrekar at gmail.com Tue Jul 8 14:47:28 2014 From: pratikmandrekar at gmail.com (Pratik Mandrekar) Date: Tue, 8 Jul 2014 18:17:28 +0530 Subject: [BangPypers] BangPypers Digest, Vol 83, Issue 3 In-Reply-To: References: Message-ID: Notes on using the post_save signal 1 - Do not use post_save to save the instance that is passed. The `instance.save` is going to cause a never ending loop. 2 - Use post_save signal to do things not related to updating the model being saved. Like updating a related model. 3 - Override the save method of the model to do any changes you need to do to override the default save. 4 - If you have to use signals in this case (Eg. You cannot edit the models because they are part of a different library) use the pre_save signal and just modify the attributes without calling `instance.save()` On Tue, Jul 8, 2014 at 3:30 PM, wrote: > Send BangPypers mailing list submissions to > bangpypers at python.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.python.org/mailman/listinfo/bangpypers > or, via email, send a message with subject or body 'help' to > bangpypers-request at python.org > > You can reach the person managing the list at > bangpypers-owner at python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of BangPypers digest..." > > > Today's Topics: > > 1. Anyone Travelling for EuroPython ? (konark modi) > 2. Django - Infinte Loop (Anand Reddy Pandikunta) > 3. Re: Django - Infinte Loop (kracekumar ramaraju) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Mon, 7 Jul 2014 21:49:07 +0530 > From: konark modi > To: Bangalore Python Users Group - India > Subject: [BangPypers] Anyone Travelling for EuroPython ? > Message-ID: > < > CAPhs5j_9hrF-JAvT+uhbCA8HfxaOjk8sYrzL__UXaA04Q7YE1g at mail.gmail.com> > Content-Type: text/plain; charset=UTF-8 > > Hi > > Wanted to know if anyone on the list is planning to travel for EuroPython > 2014 this July. > > Regards > Konark > > > ------------------------------ > > Message: 2 > Date: Tue, 8 Jul 2014 13:13:02 +0530 > From: Anand Reddy Pandikunta > To: Bangalore Python Users Group - India > Subject: [BangPypers] Django - Infinte Loop > Message-ID: > nHOFnLVqniQ at mail.gmail.com> > Content-Type: text/plain; charset=ISO-8859-1 > > Hi, > > *models.py* > > *def my_func(sender, instance, created, **kwargs):* > * # do something* > * instance.status = 'task completed'* > * instance.save()* > > *class MyModel(models.Model):* > * status = models.CharField(max_length=100, blank=True)* > * # some code* > > *signals.post_save.connect(my_func, sender=MyModel)* > > > I am using post_save signal to connect to a function. > > If a new instance of model is saved, post_save signal connects to my_func. > Once the function is executed, I am updating status of the model. > This is again sending post_save signal which is leading to infinite loop. > > I want to execute my_func only once and update status many times. > Does any one know how to do this? > > > -- > - Anand Reddy Pandikunta > www.avilpage.com > www.quotes160.com > > > ------------------------------ > > Message: 3 > Date: Tue, 8 Jul 2014 13:27:09 +0530 > From: kracekumar ramaraju > To: Bangalore Python Users Group - India > Subject: Re: [BangPypers] Django - Infinte Loop > Message-ID: > u96wVFwP6DEQ at mail.gmail.com> > Content-Type: text/plain; charset=UTF-8 > > Hi Anand > > I would save *don't* use Django signal. Signals are hard to test and don't > know when they will be executed. > > Suggestions > - If post_save function does some work like updating external service which > can take data, use rq or celery. > - You can override django save. > > class MyModel(BaseClass): > > def save(self, **kwargs) > # set all attributes > # call super class save > # call function here - blocking call. > > > > > > On Tue, Jul 8, 2014 at 1:13 PM, Anand Reddy Pandikunta < > anand21nanda at gmail.com> wrote: > > > Hi, > > > > *models.py* > > > > *def my_func(sender, instance, created, **kwargs):* > > * # do something* > > * instance.status = 'task completed'* > > * instance.save()* > > > > *class MyModel(models.Model):* > > * status = models.CharField(max_length=100, blank=True)* > > * # some code* > > > > *signals.post_save.connect(my_func, sender=MyModel)* > > > > > > I am using post_save signal to connect to a function. > > > > If a new instance of model is saved, post_save signal connects to > my_func. > > Once the function is executed, I am updating status of the model. > > This is again sending post_save signal which is leading to infinite loop. > > > > I want to execute my_func only once and update status many times. > > Does any one know how to do this? > > > > > > -- > > - Anand Reddy Pandikunta > > www.avilpage.com > > www.quotes160.com > > _______________________________________________ > > BangPypers mailing list > > BangPypers at python.org > > https://mail.python.org/mailman/listinfo/bangpypers > > > > > > -- > > *Thanks & Regardskracekumar"Talk is cheap, show me the code" -- Linus > Torvaldshttp://kracekumar.com * > > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > https://mail.python.org/mailman/listinfo/bangpypers > > > ------------------------------ > > End of BangPypers Digest, Vol 83, Issue 3 > ***************************************** > From ppc.lists at gmail.com Thu Jul 10 07:42:18 2014 From: ppc.lists at gmail.com (Pradip Caulagi) Date: Thu, 10 Jul 2014 11:12:18 +0530 Subject: [BangPypers] Django - Infinte Loop In-Reply-To: References: Message-ID: <53BE27BA.3010900@gmail.com> On Tuesday 08 July 2014 01:13 PM, Anand Reddy Pandikunta wrote: > Hi, > > *models.py* > > *def my_func(sender, instance, created, **kwargs):* > * # do something* > * instance.status = 'task completed'* > * instance.save()* > > *class MyModel(models.Model):* > * status = models.CharField(max_length=100, blank=True)* > * # some code* > > *signals.post_save.connect(my_func, sender=MyModel)* Like others have noted, you should override model save. Another option would be to use pre_save. Just set instance.status and don't call instance.save? From anand21nanda at gmail.com Fri Jul 11 09:07:53 2014 From: anand21nanda at gmail.com (Anand Reddy Pandikunta) Date: Fri, 11 Jul 2014 12:37:53 +0530 Subject: [BangPypers] Django - Infinte Loop In-Reply-To: <53BE27BA.3010900@gmail.com> References: <53BE27BA.3010900@gmail.com> Message-ID: I have overrided model save. Moved couple of functions from models.py to tasks.py which lead to circular imports. Instead of importing models at the beginning of file, I've imported them in the functions. Thank you @krace, @navin, @pradip :) On Thu, Jul 10, 2014 at 11:12 AM, Pradip Caulagi wrote: > On Tuesday 08 July 2014 01:13 PM, Anand Reddy Pandikunta wrote: > >> Hi, >> >> *models.py* >> >> *def my_func(sender, instance, created, **kwargs):* >> * # do something* >> * instance.status = 'task completed'* >> * instance.save()* >> >> *class MyModel(models.Model):* >> * status = models.CharField(max_length=100, blank=True)* >> * # some code* >> >> *signals.post_save.connect(my_func, sender=MyModel)* >> > > Like others have noted, you should override model save. Another option > would be to use pre_save. Just set instance.status and don't call > instance.save? > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > https://mail.python.org/mailman/listinfo/bangpypers > -- - Anand Reddy Pandikunta www.avilpage.com www.quotes160.com From arunvr at gmail.com Fri Jul 11 12:55:05 2014 From: arunvr at gmail.com (Arun Ravindran) Date: Fri, 11 Jul 2014 16:25:05 +0530 Subject: [BangPypers] Django - Infinte Loop In-Reply-To: References: <53BE27BA.3010900@gmail.com> Message-ID: Hi, >From Django 1.7 onwards, the proper way to register signals will be inside a ready function in the app's configuration object. This is thanks to the App-loading refactor done in the release. In your case, as mentioned in the docs, create an myapp/apps.py with : from django.apps import AppConfig class MyAppConfig(AppConfig): def ready(self): MyModel = self.get_model('MyModel') signals.post_save.connect(my_func, sender=MyModel) Also add a line to myapp/__init__.py : default_app_config = 'myapp.apps.MyAppConfig' This would eliminate circular imports. Cheers, Arun On Fri, Jul 11, 2014 at 12:37 PM, Anand Reddy Pandikunta < anand21nanda at gmail.com> wrote: > I have overrided model save. > Moved couple of functions from models.py to tasks.py which lead to circular > imports. > Instead of importing models at the beginning of file, I've imported them in > the functions. > > Thank you @krace, @navin, @pradip :) > > > > On Thu, Jul 10, 2014 at 11:12 AM, Pradip Caulagi > wrote: > > > On Tuesday 08 July 2014 01:13 PM, Anand Reddy Pandikunta wrote: > > > >> Hi, > >> > >> *models.py* > >> > >> *def my_func(sender, instance, created, **kwargs):* > >> * # do something* > >> * instance.status = 'task completed'* > >> * instance.save()* > >> > >> *class MyModel(models.Model):* > >> * status = models.CharField(max_length=100, blank=True)* > >> * # some code* > >> > >> *signals.post_save.connect(my_func, sender=MyModel)* > >> > > > > Like others have noted, you should override model save. Another option > > would be to use pre_save. Just set instance.status and don't call > > instance.save? > > > > _______________________________________________ > > BangPypers mailing list > > BangPypers at python.org > > https://mail.python.org/mailman/listinfo/bangpypers > > > > > > -- > - Anand Reddy Pandikunta > www.avilpage.com > www.quotes160.com > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > https://mail.python.org/mailman/listinfo/bangpypers > From arundhaj at gmail.com Mon Jul 14 09:21:14 2014 From: arundhaj at gmail.com (Arun Kumar Dharuman) Date: Mon, 14 Jul 2014 12:51:14 +0530 Subject: [BangPypers] Visualization of PyCon India 2014 Message-ID: Hi All, I've created visualization of proposals submitted on the Funnel using d3js. http://www.arundhaj.com/blog/visualization-of-pycon-2014-proposals.html Regards ArunDhaJ From careers at doublespring.com Mon Jul 14 13:31:35 2014 From: careers at doublespring.com (Shuhaib Shariff) Date: Mon, 14 Jul 2014 17:01:35 +0530 Subject: [BangPypers] [JOBS] Django / AngularJS developers Message-ID: DoubleSpring seeks passionate DJANGO developers with experience in building or contributing to Open Source projects. We are constantly rolling out new products so the right individual would be able to write clean code and work in a fast pace environment. We highly value native ability, passion and the right attitude. Requirements - Technical proficiency with Python / Django. - Technical proficiency in JavaScript / AngularJS - Experience with MySQL / PgSQL. - Experience with MVC design patterns and solid algorithm skills. - 1-3 years of industry experience (Freshers may apply) Location: Bangalore How to apply Send your resume to: careers [at] doublespring.com From nitin.nitp at gmail.com Tue Jul 15 11:55:48 2014 From: nitin.nitp at gmail.com (Nitin Kumar) Date: Tue, 15 Jul 2014 15:25:48 +0530 Subject: [BangPypers] Is there a way to find the import originator? Message-ID: Hi All, Say there are 3 files. a.py and b.py uses *import c* (which is the third python file c.py) is there a way we can know inside c.py that whether its a or b who is doing the importing? Nitin K From gora at mimirtech.com Tue Jul 15 12:00:22 2014 From: gora at mimirtech.com (Gora Mohanty) Date: Tue, 15 Jul 2014 15:30:22 +0530 Subject: [BangPypers] Is there a way to find the import originator? In-Reply-To: References: Message-ID: On 15 July 2014 15:25, Nitin Kumar wrote: > Hi All, > > Say there are 3 files. > > a.py and b.py uses *import c* (which is the third python file c.py) > > is there a way we can know inside c.py that whether its a or b who is doing > the importing? You can use the inspect module to get this information, e.g., see http://stackoverflow.com/questions/2654113/python-how-to-get-the-callers-method-name-in-the-called-method IMHO it is not good design for a module to depend on who is calling it. If you need that, pass a parameter to __init__ Regards, Gora From avinashsajjan at gmail.com Tue Jul 15 12:25:11 2014 From: avinashsajjan at gmail.com (avinash sajjanshetty) Date: Tue, 15 Jul 2014 15:55:11 +0530 Subject: [BangPypers] [JOBS] Django / AngularJS developers (Shuhaib Shariff) Message-ID: the 'Jobs' link in your footer doesn't work. From baiju.m.mail at gmail.com Thu Jul 17 19:13:54 2014 From: baiju.m.mail at gmail.com (Baiju Muthukadan) Date: Thu, 17 Jul 2014 10:13:54 -0700 (PDT) Subject: [BangPypers] PyCon India 2014: Nominations open for the Kenneth Gonsalves 2014 award Message-ID: <53c80452.41ca440a.3b02.ffff8510@mx.google.com> Hello All! The first ever Kenneth Gonsalves award was presented to Baiju Muthukadan last year. Read about last year's award ceremony here: http://in.pycon.org/blog/baijum-first-kenneth-gonsalves-award-recipient This award is instituted by PSSI and PSF in the name of our late friend and mentor, Kenneth Gonsalves who passed away in August 2012. KG, as he is fondly known in the community, was the founder of the Indian Python Software Society. This award is for the ones who are doing exemplary work in Python programming language, its development/adoption/advocacy in India. With PyCon India 2014 just two months away, it is time for us to nominate a worthy candidate for this year's Kenneth Gonsalves award. The nominations are open now. If you would like to put forward the name of an Indian citizen who is deserving of this great honor, please visit the following Nomination form and propose their name. Nomination form: https://docs.google.com/forms/d/1SEy0k4GxMIEJEY4vCXDCqxOSUQJZ7uIUeA0nf-EleMw/viewform The last date for nominations is September 1st 2014, midnight. Make sure you speak for the best out there! Please like & share this from our blog post: http://in.pycon.org/2014/blog/nominations-open-for-the-kenneth-gonsalves-2014-award/ From nikit.saraf at gmail.com Fri Jul 18 11:33:51 2014 From: nikit.saraf at gmail.com (Nikit Saraf) Date: Fri, 18 Jul 2014 15:03:51 +0530 Subject: [BangPypers] [JOBS] Full Stack Developer Message-ID: Job Description: Full Stack Developer @ mircmedia July, 2014 Location: Mumbai Nature: Full time employment Compensation: Cash + equity Preferred Skills 1. Solid Python Skills with strong Django experience 2. Experience with REST architectures and API integration 3. Experience with Mongodb/NoSQL 4. Experience with Celery (Preferred but optional) 5. Familiarity with Amazon AWS 6. Ability to plan for system scalability 7. Ability to manage a cloud-based infrastructure built on Amazon Web Services 8. Proficient with Linux 9. Proficiency in HTML, CSS especially Boostrap 3 framework 10. Attitude: We?re sticklers for a problem solver and self learner attitude which is a must have to survive in early stage companies (aka startups) Key Takeaways: 1. Learning business : This role is a part of the founding team that is building the model around this product. You will get to experience what it takes to build a business out of a product. 2. Product definition: This role will let you imprint your marks on the product as you play an integral part in defining the first public beta. 3. Network: mirc media is a part of Zone Startups India - a joint venture between Bombay Stock Exchange and Ryerson University (Canada) giving our team a ready access to investors, market and talent in addition to a set of peer entrepreneurs working together with us. 4. Ownership: You will be entitled to stock options as per the company?s ESOP plan. About mirc media: Mirc Media is a digital analytics company that helps celebrity managers and television sales teams to measure and understand their audience base. Existing second screen engagements on the web are used as primary feeds to mine intelligence. mirc media?s consumers use the cloud based real time dashboard to estimate the reach and the quality of the reach of the audience/ fan base. Industry: Media & Entertainment- celebrities (sports, tv, movies and business) and television channels Key People you will be working with: a) Lavin Mirchandani, Founder & CEO Lavin founded mirc media as a boutique consulting firm that previously helped bollywood films launch their digital campaigns. He spearheaded the digital campaigns and analytics projects for banners such as Shakti Samanta Films, Goel Screencraft, Aron Govil Productions, Hiten Tejwani and consumer brands such as Idea Cellular, Hero Motor Company amongst others. He has also been the Associate Director for Communications & Alliances at The Indus Entrepreneurs (TiE) in Mumbai, where he helped this global body of entrepreneurs establish a strong presence on the digital space while actively enabling the entrepreneur-investor ecosystem in Mumbai. Lavin holds a bachelors degree in electronics Engineering from VESIT and has been a fellow of the global Startup Leadership Program. b) Paras Doshi, Technology architect and mentor Paras is a hardcore technologist. His work spans from making patented technology to make smart phones better at Qualcomm's San Diego headquarters to storing critical business data on a scalable cloud platform at his own startup in Mumbai. Paras has two masters from University of Wisconsin,Madison, USA, one in Computer Science and another in Electrical Engineering. He has designed the product architecture and currently mentors the programming team. Contact: Lavin Mirchandani mirc media | television and celebrity audience measurement + insights m: +91 998765 9900 | t: @lavinm | w: www.mircmedia.com | a: ZoneStartups India, 18th Floor, Bombay Stock Exchange Ltd., Dalal Street, Mumbai - 400001, INDIA From anand21nanda at gmail.com Fri Jul 18 18:09:22 2014 From: anand21nanda at gmail.com (Anand Reddy Pandikunta) Date: Fri, 18 Jul 2014 21:39:22 +0530 Subject: [BangPypers] Python - APK Downloader for Play Store Message-ID: Hi, I want to write a program/package to download apk files from play store. Can some one tell me where to get started & how to proceed? Thank you. -- - Anand Reddy Pandikunta www.avilpage.com www.quotes160.com From baiju.m.mail at gmail.com Sat Jul 19 07:05:23 2014 From: baiju.m.mail at gmail.com (Baiju Muthukadan) Date: Fri, 18 Jul 2014 22:05:23 -0700 (PDT) Subject: [BangPypers] PyCon India 2014: Talk selection Message-ID: <53c9fc93.0c85440a.5cda.4192@mx.google.com> Hi All, The wheels are in motion! After a month of voting and an exhausting review process, the first set of confirmed talks are out. Head over to the funnel ( http://in.pycon.org/funnel/2014/ ) to see them. All the workshops have been finalized and we will be opening the workshop tickets by 21st of July. The talk selection process is still under way and the final list will be announced tentatively by the end of July. A gazillion thanks to all of you who voted and took your time to comment on the proposals. We urge you to continue the communication with the selected speakers so that they can work towards fine tuning their presentations. Bet that is incentive enough for many of you who are still thinking of purchasing a ticket. Get your tickets now ! ( http://pyconindia2014.doattend.com/ ) Further announcements in the queue. -- Baiju M From baiju.m.mail at gmail.com Sun Jul 20 04:59:02 2014 From: baiju.m.mail at gmail.com (Baiju M) Date: Sun, 20 Jul 2014 08:29:02 +0530 Subject: [BangPypers] July BangPypers meetup videos Message-ID: Hi, I just uploaded Yesterday's meetup videos here (Talks): https://www.youtube.com/watch?v=gNLFa9ZmWMA https://www.youtube.com/watch?v=y0KLjTcBbow I started uploading first 46 minutes of Workshop, but uploading is not yet completed, if uploading goes well in another few hours, it will be available here: https://www.youtube.com/watch?v=Yr6pEEaYziQ I hope Krace will publish a report in our blog here: http://bangalore.python.org.in/ Regards, Baiju M From vimal.k at ieee.org Mon Jul 21 11:55:31 2014 From: vimal.k at ieee.org (VIMAL K) Date: Mon, 21 Jul 2014 15:25:31 +0530 Subject: [BangPypers] GAE python oauth login Message-ID: I want to implement google oauth login service to my application. Can anyone help me with it. I have written func, please help me to continue with it. The code i've written: def google_login(self): flow = OAuth2WebServerFlow( client_id='client-code', client_secret='client secret', redirect_uri='--url--', scope='', user_agent='') authorize_url = flow.step1_get_authorize_url() self.redirect(authorize_url) credentials = flow.step2_exchange(self.request.params) storage = Storage('a_credentials_file') storage.put(credentials) http = httplib2.Http() https = credentials.authorize(http) service = build('calendar', 'v3', http=http) credentials = storage.get() From vnbang2003 at gmail.com Tue Jul 22 06:59:45 2014 From: vnbang2003 at gmail.com (vijay kumar) Date: Tue, 22 Jul 2014 10:29:45 +0530 Subject: [BangPypers] [X-post] : PyCon India 2014 workshop registrations are now open Message-ID: Hi, We are excited to let you know that we have a choice of 9 awesome workshops available on September 26 2014, Friday as part of PyCon India 2014. These workshops will happen in 3 parallel tracks, so you can attend a maximum of 3 workshops. The seats in each workshop are limited to keep it very interactive. A separate ticket much be purchased for attending each workshop and each ticket costs Rs. 1000/-. If you haven't bought tickets already, go and grab them at: *http://pyconindia2014-workshop.doattend.com If you are a student, use discount code **STUDENT** to avail 50% student discount. Breakfast, lunch and tea/snacks are included in the ticket. *Here is the schedule of workshops.* Slot / RoomTrack 1Track 2*Track 3*9.30- 12.00learn-python-in-minutes security-toolsmithing-writing-security-tools-in-python scrape-anything-even-the-most-difficult-sites13.00 - 15.30document-your-code getting-started-with-djangomobile-application-development-with-python-kivy16.00 - 18.30decorators-demystifiedtest-your-web-app-with-selenium expeyes-python-powered-open-source-portable-science-lab The full schedule of the workshops and more detail about each workshop are available on the conference website. We look forward to see you at the workshops. -- Thanks, Vijay From srinivas at srinivasganti.com Tue Jul 22 08:13:51 2014 From: srinivas at srinivasganti.com (Srinivas Ganti) Date: Tue, 22 Jul 2014 01:13:51 -0500 Subject: [BangPypers] Did anybody try Mezzanine CMS? Message-ID: -- Regards Srinivas Ganti - From gora at mimirtech.com Tue Jul 22 09:33:23 2014 From: gora at mimirtech.com (Gora Mohanty) Date: Tue, 22 Jul 2014 13:03:23 +0530 Subject: [BangPypers] Did anybody try Mezzanine CMS? In-Reply-To: References: Message-ID: Yes. From anilkumar.tammineni at gmail.com Tue Jul 22 14:17:12 2014 From: anilkumar.tammineni at gmail.com (Anil Tammineni) Date: Tue, 22 Jul 2014 17:47:12 +0530 Subject: [BangPypers] Openpyxl: Password protected document Message-ID: Hi All, I want to write data into an excel file and make this excel file password protected. I am able to read/write data in to this excel file (.xlsx) using openpyxl. How can we make this document password protected using openpyxl? Any example pointer would be helpful. Thanks, Anil From ankitarath2011 at gmail.com Tue Jul 22 17:57:42 2014 From: ankitarath2011 at gmail.com (Ankita Rath) Date: Tue, 22 Jul 2014 21:27:42 +0530 Subject: [BangPypers] Pygtk Message-ID: Hi, I am using pygtk for GUI. We can import gtk module for this. But lot of places i have seen pygtk module along with gtk module. So can somebody tell me what is the use of this pygtk module. import pygtk import gtk we can do everything with gtk module only. So when is this pygtk module is useful. Thank you in anticipation. Regards, Ankita From gora at mimirtech.com Wed Jul 23 21:08:32 2014 From: gora at mimirtech.com (Gora Mohanty) Date: Thu, 24 Jul 2014 00:38:32 +0530 Subject: [BangPypers] Pygtk In-Reply-To: References: Message-ID: On 22 July 2014 21:27, Ankita Rath wrote: > > Hi, > > I am using pygtk for GUI. We can import gtk module for this. But lot of > places i have seen pygtk module along with gtk module. So can somebody tell > me what is the use of this pygtk module. > > import pygtk > import gtk > > we can do everything with gtk module only. So when is this pygtk module is > useful. pygtk has pretty decent documentation, which you might want to read carefully: Please see the right-hand sidebar at http://www.pygtk.org/ >From the tutorial: "The variables and functions that are defined in the PyGTK module are named as gtk.*. So, you are very likely using functions from pygtk, even when they are named as gtk.XXX. If you are so inclined, you can look into the two modules to figure out what is defined where. Regards, Gora From skb655952 at gmail.com Wed Jul 23 21:33:45 2014 From: skb655952 at gmail.com (sayantan bhattacharya) Date: Thu, 24 Jul 2014 01:03:45 +0530 Subject: [BangPypers] Pygtk In-Reply-To: References: Message-ID: Here's another page which kind of summarizes the difference between gtk and pygtk. If you are into creating UI using gtk, I would suggest using some wrapper module like wx or QT. -- Sayantan On Thu, Jul 24, 2014 at 12:38 AM, Gora Mohanty wrote: > On 22 July 2014 21:27, Ankita Rath wrote: > > > > Hi, > > > > I am using pygtk for GUI. We can import gtk module for this. But lot of > > places i have seen pygtk module along with gtk module. So can somebody > tell > > me what is the use of this pygtk module. > > > > import pygtk > > import gtk > > > > we can do everything with gtk module only. So when is this pygtk module > is > > useful. > > > pygtk has pretty decent documentation, which you might want to read > carefully: > Please see the right-hand sidebar at http://www.pygtk.org/ > > From the tutorial: "The variables and functions that are defined in the > PyGTK > module are named as gtk.*. So, you are very likely using functions from > pygtk, > even when they are named as gtk.XXX. If you are so inclined, you can look > into > the two modules to figure out what is defined where. > > Regards, > Gora > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > https://mail.python.org/mailman/listinfo/bangpypers > -- Sayantan Bhattacharya From vimal.k at ieee.org Thu Jul 24 12:34:58 2014 From: vimal.k at ieee.org (VIMAL K) Date: Thu, 24 Jul 2014 16:04:58 +0530 Subject: [BangPypers] Oauth Google Login for python Message-ID: Hello, I am learning python and presently working on a project to familiarize myself in python. I want to implement a login system. So i taught it would be better to use google oauth login. I went through the api doc, but couldn finih on the code. Can anyone help me with it. From anand at erpnext.com Thu Jul 24 12:52:55 2014 From: anand at erpnext.com (Anand Doshi) Date: Thu, 24 Jul 2014 16:22:55 +0530 Subject: [BangPypers] Oauth Google Login for python In-Reply-To: References: Message-ID: Hi Vimal, Use rauth python library: https://github.com/litl/rauth Also have a look at this: https://github.com/frappe/frappe/blob/develop/frappe/templates/pages/login.py Regards, Anand Doshi. On Thu, Jul 24, 2014 at 4:04 PM, VIMAL K wrote: > Hello, > I am learning python and presently working on a project to familiarize > myself in python. I want to implement a login system. So i taught it would > be better to use google oauth login. I went through the api doc, but couldn > finih on the code. Can anyone help me with it. > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > https://mail.python.org/mailman/listinfo/bangpypers > From vimal.k at ieee.org Fri Jul 25 12:42:24 2014 From: vimal.k at ieee.org (VIMAL K) Date: Fri, 25 Jul 2014 16:12:24 +0530 Subject: [BangPypers] =?utf-8?q?Stack_Overflow_Questions_Tags_Users_Badges?= =?utf-8?q?_Unanswered_Ask_Question_google_oauth_login_Python=3A_?= =?utf-8?q?=E2=80=9CInvalid_parameter_value_for_redirect=5Furi=3A_M?= =?utf-8?q?issing_scheme=3A_None=E2=80=9D?= Message-ID: This is my code: flow = OAuth2WebServerFlow(client_id='XXXXXX',client_secret='XXXXXXXXX',scope=' https://www.googleapis.com/auth/userinfo.email',redirect_uri=' https://XXXXXXXX.com/oauth2callback') log.debug(flow.__dict__) if not self.request.get("code"): auth_uri = flow.step1_get_authorize_url() log.debug("the link " + auth_uri) self.redirect(auth_uri) else: code = self.request.get("code") log.debug("code=>"+str(code)) credentials = flow.step2_exchange(str(code)) http = httplib2.Http() http = credentials.authorize(http) log.info('authorisation completed') service = build('gmail', 'v2', http=http) self.render_json(service.__dict__) After all this, code. i am getting an error as below: Failed to retrieve access token: { "error" : "invalid_request", "error_description" : "Invalid parameter value for redirect_uri: Missing scheme: None" } Can anyone help me out. Stuck for a 2 days on this. From ankitarath2011 at gmail.com Thu Jul 24 10:50:50 2014 From: ankitarath2011 at gmail.com (Ankita Rath) Date: Thu, 24 Jul 2014 14:20:50 +0530 Subject: [BangPypers] Pygtk In-Reply-To: References: Message-ID: Thank you Gora. Sayantan i did not understand the page you have mentioned. i could not find any link i your reply. Functionality wise QT n pygtk are same na. On Thu, Jul 24, 2014 at 1:03 AM, sayantan bhattacharya wrote: > Here's another page which kind of summarizes the difference between gtk and > pygtk. If you are into creating UI using gtk, I would suggest using some > wrapper module like wx or QT. > > -- > Sayantan > > > On Thu, Jul 24, 2014 at 12:38 AM, Gora Mohanty wrote: > > > On 22 July 2014 21:27, Ankita Rath wrote: > > > > > > Hi, > > > > > > I am using pygtk for GUI. We can import gtk module for this. But lot of > > > places i have seen pygtk module along with gtk module. So can somebody > > tell > > > me what is the use of this pygtk module. > > > > > > import pygtk > > > import gtk > > > > > > we can do everything with gtk module only. So when is this pygtk module > > is > > > useful. > > > > > > pygtk has pretty decent documentation, which you might want to read > > carefully: > > Please see the right-hand sidebar at http://www.pygtk.org/ > > > > From the tutorial: "The variables and functions that are defined in the > > PyGTK > > module are named as gtk.*. So, you are very likely using functions from > > pygtk, > > even when they are named as gtk.XXX. If you are so inclined, you can look > > into > > the two modules to figure out what is defined where. > > > > Regards, > > Gora > > _______________________________________________ > > BangPypers mailing list > > BangPypers at python.org > > https://mail.python.org/mailman/listinfo/bangpypers > > > > > > -- > Sayantan Bhattacharya > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > https://mail.python.org/mailman/listinfo/bangpypers > From skb655952 at gmail.com Fri Jul 25 14:40:27 2014 From: skb655952 at gmail.com (sayantan bhattacharya) Date: Fri, 25 Jul 2014 18:10:27 +0530 Subject: [BangPypers] Pygtk In-Reply-To: References: Message-ID: Yes, functionally they are same. I am sorry to have missed out the link : http://stackoverflow.com/questions/3961397/gtk-and-pygtk-difference. Internally the calls the same. On Jul 25, 2014 5:29 PM, "Ankita Rath" wrote: > Thank you Gora. > Sayantan i did not understand the page you have mentioned. i could not find > any link i your reply. Functionality wise QT n pygtk are same na. > > > On Thu, Jul 24, 2014 at 1:03 AM, sayantan bhattacharya < > skb655952 at gmail.com> > wrote: > > > Here's another page which kind of summarizes the difference between gtk > and > > pygtk. If you are into creating UI using gtk, I would suggest using some > > wrapper module like wx or QT. > > > > -- > > Sayantan > > > > > > On Thu, Jul 24, 2014 at 12:38 AM, Gora Mohanty > wrote: > > > > > On 22 July 2014 21:27, Ankita Rath wrote: > > > > > > > > Hi, > > > > > > > > I am using pygtk for GUI. We can import gtk module for this. But lot > of > > > > places i have seen pygtk module along with gtk module. So can > somebody > > > tell > > > > me what is the use of this pygtk module. > > > > > > > > import pygtk > > > > import gtk > > > > > > > > we can do everything with gtk module only. So when is this pygtk > module > > > is > > > > useful. > > > > > > > > > pygtk has pretty decent documentation, which you might want to read > > > carefully: > > > Please see the right-hand sidebar at http://www.pygtk.org/ > > > > > > From the tutorial: "The variables and functions that are defined in the > > > PyGTK > > > module are named as gtk.*. So, you are very likely using functions from > > > pygtk, > > > even when they are named as gtk.XXX. If you are so inclined, you can > look > > > into > > > the two modules to figure out what is defined where. > > > > > > Regards, > > > Gora > > > _______________________________________________ > > > BangPypers mailing list > > > BangPypers at python.org > > > https://mail.python.org/mailman/listinfo/bangpypers > > > > > > > > > > > -- > > Sayantan Bhattacharya > > _______________________________________________ > > BangPypers mailing list > > BangPypers at python.org > > https://mail.python.org/mailman/listinfo/bangpypers > > > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > https://mail.python.org/mailman/listinfo/bangpypers > From vimal.k at ieee.org Mon Jul 28 18:19:28 2014 From: vimal.k at ieee.org (VIMAL K) Date: Mon, 28 Jul 2014 21:49:28 +0530 Subject: [BangPypers] How to convert Datastore data into a CSV file python Message-ID: Hello, i am new to python. I need to write a function which converts a datastore data to csv format, which is downloadable. I researched upon the topic over google, got few and less info on it. The code till now is below: def calllog_csv(self): from collections import defaultdict date = datetime.strptime('01/01/2014', '%m/%d/%Y') qry = CallLog.query().filter(CallLog.created >= date, CallLog.created <= datetime.now()).fetch() columns = defaultdict(qry) log.debug("query===>" + str(columns)) with open('calllog.csv', 'w') as csv_log: reader = csv.DictReader(csv_log) for row in reader: for (k, v) in row.items(): columns[k].append(v) log.debug("columns== from==>" + str(columns['from'])) return columns Tell me where i am wrong, or am i right? any suggestions would be helpfull. Thank you all in advance From gora at mimirtech.com Mon Jul 28 20:09:57 2014 From: gora at mimirtech.com (Gora Mohanty) Date: Mon, 28 Jul 2014 23:39:57 +0530 Subject: [BangPypers] How to convert Datastore data into a CSV file python In-Reply-To: References: Message-ID: On 28 July 2014 21:49, VIMAL K wrote: > > Hello, > i am new to python. I need to write a function which converts a datastore > data to csv format, which is downloadable. I researched upon the topic over > google, got few and less info on it. The code till now is below: What do you mean by "datastore" in this context? > > > def calllog_csv(self): > from collections import defaultdict > date = datetime.strptime('01/01/2014', '%m/%d/%Y') > qry = CallLog.query().filter(CallLog.created >= date, > CallLog.created <= datetime.now()).fetch() > columns = defaultdict(qry) > log.debug("query===>" + str(columns)) > with open('calllog.csv', 'w') as csv_log: > reader = csv.DictReader(csv_log) > for row in reader: > for (k, v) in row.items(): > columns[k].append(v) > log.debug("columns== from==>" + str(columns['from'])) > return columns > > Tell me where i am wrong, or am i right? any suggestions would be helpfull. > Thank you all in advance Would you be kind enough to explain how this code snippet relates to the description of what you wanted the code to do? It seems to be cut-and-pasted from somewhere else, and I cannot see how it is relevant. What in the world is "CallLog"? Regards, Gora From hussainbohra at gmail.com Tue Jul 29 06:45:38 2014 From: hussainbohra at gmail.com (HUSSAIN BOHRA) Date: Tue, 29 Jul 2014 10:15:38 +0530 Subject: [BangPypers] How to convert Datastore data into a CSV file python In-Reply-To: References: Message-ID: I think with datastore, you meant to say 'Google App Engine Datastore'... ? If this is the case, please read API details available at: https://developers.google.com/appengine/docs/python/datastore/ This would help you extracting data out of datastore. Thanks, On Mon, Jul 28, 2014 at 11:39 PM, Gora Mohanty wrote: > On 28 July 2014 21:49, VIMAL K wrote: > > > > Hello, > > i am new to python. I need to write a function which converts a datastore > > data to csv format, which is downloadable. I researched upon the topic > over > > google, got few and less info on it. The code till now is below: > > > What do you mean by "datastore" in this context? > > > > > > > def calllog_csv(self): > > from collections import defaultdict > > date = datetime.strptime('01/01/2014', '%m/%d/%Y') > > qry = CallLog.query().filter(CallLog.created >= date, > > CallLog.created <= datetime.now()).fetch() > > columns = defaultdict(qry) > > log.debug("query===>" + str(columns)) > > with open('calllog.csv', 'w') as csv_log: > > reader = csv.DictReader(csv_log) > > for row in reader: > > for (k, v) in row.items(): > > columns[k].append(v) > > log.debug("columns== from==>" + str(columns['from'])) > > return columns > > > > Tell me where i am wrong, or am i right? any suggestions would be > helpfull. > > Thank you all in advance > > > Would you be kind enough to explain how this code snippet relates to > the description > of what you wanted the code to do? It seems to be cut-and-pasted from > somewhere > else, and I cannot see how it is relevant. What in the world is "CallLog"? > > Regards, > Gora > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > https://mail.python.org/mailman/listinfo/bangpypers > -- Hussain Bohra Tavant Technologies From ramdaz at gmail.com Tue Jul 29 19:17:36 2014 From: ramdaz at gmail.com (Ramdas S) Date: Tue, 29 Jul 2014 22:47:36 +0530 Subject: [BangPypers] COMMERCIAL: Freelancers w experience in Python/Django/responsive web stuff Message-ID: Dear all, We have some extra work which may have to outsource. Only Bengaluru based developers contact me. I would love to work with non Bengaluru based guys too. But distances matter. Companies please avoid -- there is not enough margin for all of us to make. Freelancers with about 20-40 hours of spare time at least a month, please contact me off the forum on RAMDAZ AT GMAIL DOT COM... Thanks PS Admins: I hope the ad meets the guidelines From arunvr at gmail.com Wed Jul 30 19:56:25 2014 From: arunvr at gmail.com (Arun Ravindran) Date: Wed, 30 Jul 2014 23:26:25 +0530 Subject: [BangPypers] How to convert Datastore data into a CSV file python In-Reply-To: References: Message-ID: Hi Vimal, > I need to write a function which converts a datastore data to csv format, which is downloadable. Your code seems to reading a CSV file rather than writing to it. Use a DictWriter rather than a DictReader. But if you need to make it downloadable via a browser, then you need to use a web framework like Django. Check out the CSV output section from Django docs. Regards, Arun On Tue, Jul 29, 2014 at 10:15 AM, HUSSAIN BOHRA wrote: > I think with datastore, you meant to say 'Google App Engine Datastore'... ? > If this is the case, please read API details available at: > https://developers.google.com/appengine/docs/python/datastore/ > > This would help you extracting data out of datastore. > > Thanks, > > > > On Mon, Jul 28, 2014 at 11:39 PM, Gora Mohanty wrote: > > > On 28 July 2014 21:49, VIMAL K wrote: > > > > > > Hello, > > > i am new to python. I need to write a function which converts a > datastore > > > data to csv format, which is downloadable. I researched upon the topic > > over > > > google, got few and less info on it. The code till now is below: > > > > > > What do you mean by "datastore" in this context? > > > > > > > > > > > def calllog_csv(self): > > > from collections import defaultdict > > > date = datetime.strptime('01/01/2014', '%m/%d/%Y') > > > qry = CallLog.query().filter(CallLog.created >= date, > > > CallLog.created <= datetime.now()).fetch() > > > columns = defaultdict(qry) > > > log.debug("query===>" + str(columns)) > > > with open('calllog.csv', 'w') as csv_log: > > > reader = csv.DictReader(csv_log) > > > for row in reader: > > > for (k, v) in row.items(): > > > columns[k].append(v) > > > log.debug("columns== from==>" + str(columns['from'])) > > > return columns > > > > > > Tell me where i am wrong, or am i right? any suggestions would be > > helpfull. > > > Thank you all in advance > > > > > > Would you be kind enough to explain how this code snippet relates to > > the description > > of what you wanted the code to do? It seems to be cut-and-pasted from > > somewhere > > else, and I cannot see how it is relevant. What in the world is > "CallLog"? > > > > Regards, > > Gora > > _______________________________________________ > > BangPypers mailing list > > BangPypers at python.org > > https://mail.python.org/mailman/listinfo/bangpypers > > > > > > -- > Hussain Bohra > Tavant Technologies > _______________________________________________ > BangPypers mailing list > BangPypers at python.org > https://mail.python.org/mailman/listinfo/bangpypers >