Python for Good
I wanted to let everyone know about Python for Good, a Python event that is happening in the Portland, Oregon area. Put simply, we get a bunch of pythonistas (along with anyone else interested in doing good) and we gather for a long weekend (Thurs - Sun) of using our awesome skills to build apps for social and civic good organizations. Our theme for this year is children and families and some of the places we'll be helping this year include a homeless shelter, numerous organizations that help children, and many more amazing and worthwhile organizations.
The event is all inclusive, meaning that we stay in university dorms, all the food is provided and we have pretty great internet too. Our days are filled with hacking and our evenings are full of excellent camaraderie -- playing boardgames, video games, karaoke, werewolf, cards and lots of excellent socializing!
We are excited to announce that we're going to be once again holding the event at Reed College from July 26th to the 29th.
You can find more information about this years' event here: http://pythonforgood.org/attend Here is a list of the most frequently asked questions here: http://pythonforgood.io/faq
I'd be delighted to answer any questions.
Happiness,
Sean (and the Python for Good team)
/r/Python
https://redd.it/8ciq36
I wanted to let everyone know about Python for Good, a Python event that is happening in the Portland, Oregon area. Put simply, we get a bunch of pythonistas (along with anyone else interested in doing good) and we gather for a long weekend (Thurs - Sun) of using our awesome skills to build apps for social and civic good organizations. Our theme for this year is children and families and some of the places we'll be helping this year include a homeless shelter, numerous organizations that help children, and many more amazing and worthwhile organizations.
The event is all inclusive, meaning that we stay in university dorms, all the food is provided and we have pretty great internet too. Our days are filled with hacking and our evenings are full of excellent camaraderie -- playing boardgames, video games, karaoke, werewolf, cards and lots of excellent socializing!
We are excited to announce that we're going to be once again holding the event at Reed College from July 26th to the 29th.
You can find more information about this years' event here: http://pythonforgood.org/attend Here is a list of the most frequently asked questions here: http://pythonforgood.io/faq
I'd be delighted to answer any questions.
Happiness,
Sean (and the Python for Good team)
/r/Python
https://redd.it/8ciq36
Solid examples using *args and **kwargs
I have seen these in various snippets of code. I am looking for some really good use case examples.
/r/Python
https://redd.it/8ci7qw
I have seen these in various snippets of code. I am looking for some really good use case examples.
/r/Python
https://redd.it/8ci7qw
reddit
Solid examples using *args and **kwargs • r/Python
I have seen these in various snippets of code. I am looking for some really good use case examples.
Flask-Restful API Help? POST method is not allowed
Hi,
I created a Flask-Restful API but when creating a post method like so
class Create(Resource):
def post(self):
etc etc
api.add_resource(Create,api/Create)
It errors out saying the method is not allowed.. but it works when I have something like this
@app.route("/signup/<username>,<password>", methods = ['GET', 'POST'])
def signup(username, password):
Can anybody assist? How do I allow the POST method using the first method?
/r/flask
https://redd.it/8chql1
Hi,
I created a Flask-Restful API but when creating a post method like so
class Create(Resource):
def post(self):
etc etc
api.add_resource(Create,api/Create)
It errors out saying the method is not allowed.. but it works when I have something like this
@app.route("/signup/<username>,<password>", methods = ['GET', 'POST'])
def signup(username, password):
Can anybody assist? How do I allow the POST method using the first method?
/r/flask
https://redd.it/8chql1
reddit
Flask-Restful API Help? POST method is not allowed • r/flask
Hi, I created a Flask-Restful API but when creating a post method like so class Create(Resource): def post(self): etc...
Single Page Apps with Flask and Angular 4|5 Tutorial Series
https://www.techiediaries.com/flask-angular-tutorial/
/r/flask
https://redd.it/8cm0hi
https://www.techiediaries.com/flask-angular-tutorial/
/r/flask
https://redd.it/8cm0hi
Techiediaries
Single Page Apps with Flask and Angular 4|5 Tutorial Series | Techiediaries
In this tutorial series we'll be using Python, Flask, SQLAlchemy and Angular 5 to build a modern RESTful web application with an architecture that consists of a front-end application with Angular 5 and a back-end REST API using Flask.
A Continuous Integration/Deployment (CI/CD) system for Django, using GitHub, Codeship, and AWS
https://diagramy.com/diagram/18af2ef2-736e-4fd2-afcb-b4ee02f1da73/
/r/django
https://redd.it/8cmplx
https://diagramy.com/diagram/18af2ef2-736e-4fd2-afcb-b4ee02f1da73/
/r/django
https://redd.it/8cmplx
Diagramy
Django CI/CD System
This diagram shows a Django CI/CD system. The system uses GitHub and Codeship to quickly deploy new software releases to infrastructure running on ...
Requesting User details from JWT in Django OAuth Toolkit
https://theleakycauldronblog.com/blog/requesting-user-details-from-jwt-in-django-oauth-toolkit/
/r/djangolearning
https://redd.it/8cl6ei
https://theleakycauldronblog.com/blog/requesting-user-details-from-jwt-in-django-oauth-toolkit/
/r/djangolearning
https://redd.it/8cl6ei
Theleakycauldronblog
Requesting User details from JWT in Django OAuth Toolkit
Learn to write an API to fetch the details of currently logged in user, using the Authorization Token, in Django Oauth Toolkit
PyPi is currently experiencing downtime due to an upgrade gone wrong
https://status.python.org
/r/Python
https://redd.it/8cojrq
https://status.python.org
/r/Python
https://redd.it/8cojrq
status.python.org
Python Infrastructure Status
Welcome to Python Infrastructure's home for real-time and historical data on system performance.
Ethereum Smart Contracts in Python: a comprehensive(ish) guide
https://medium.com/m/global-identity?redirectUrl=https://hackernoon.com/ethereum-smart-contracts-in-python-a-comprehensive-ish-guide-771b03990988
/r/Python
https://redd.it/8cmmx5
https://medium.com/m/global-identity?redirectUrl=https://hackernoon.com/ethereum-smart-contracts-in-python-a-comprehensive-ish-guide-771b03990988
/r/Python
https://redd.it/8cmmx5
Hacker Noon
Ethereum Smart Contracts in Python: a comprehensive(ish) guide
It’s one thing to get a basic smart contract up on Ethereum — just google “ERC20 Token Tutorial” you’ll find plenty of information on how…
Taskpacker - a Python library for schedule optimization
https://github.com/Edinburgh-Genome-Foundry/Taskpacker
/r/Python
https://redd.it/8cofmh
https://github.com/Edinburgh-Genome-Foundry/Taskpacker
/r/Python
https://redd.it/8cofmh
GitHub
GitHub - Edinburgh-Genome-Foundry/Taskpacker: :school_satchel: Simple schedule optimization library for Python
:school_satchel: Simple schedule optimization library for Python - Edinburgh-Genome-Foundry/Taskpacker
New stable release of PySolFC — an open-source collection of over 1,000 card Solitaire/Mahjong games
[PySolFC](http://pysolfc.sourceforge.net/) is a free and open-source collection of over 1,000 card Solitaire and Mahjong games with many features and solver/analysis tools. It is almost [20 years old](http://solitaire.vegard2.net/pysol.html), and the current development efforts are concentrated on [the GitHub repository](https://github.com/shlomif/PySolFC).
The PySolFC developers are happy to announce a new stable release, 2.2.0, of PySolFC (the last one was in distant 2009!). Among the new features are:
* Compatibility with both Python 3.x and Python 2.7.
* Support for the Kivy user-interface toolkit, for Android devices and other systems.
* A Microsoft Windows binary installer.
* Support for dealing all [Freecell Pro deals](http://fc-solve.shlomifish.org/faq.html#what_are_ms_deals) by specifying "ms100000", or similar, as the seed.
* Support for the [Black Hole and All in a Row solver](http://www.shlomifish.org/open-source/projects/black-hole-solitaire-solver/) was added.
* Test suite and [CI](https://en.wikipedia.org/wiki/Continuous_integration) have been added to the repository.
* The code now passes [flake8](https://pypi.python.org/pypi/flake8) validation.
You can find [download links](https://sourceforge.net/projects/pysolfc/files/PySolFC/) for current Windows, source code, and Android versions.
Packages for Linux/BSD/etc. distributions and operating systems should be made
available soon from the downstream packagers.
Future plans:
* Vector-based fully scalable cards and graphics
* Large-scale cardsets for HD displays
* An online, WWW-based version
If you want to help, we need:
* Programmers
* Graphic designers who would help with improving the app’s look
* People to help with documentation and translations
* People who would spread the word
* Testers / QA people
* Monetary donations - see [this page](http://www.shlomifish.org/meta/how-to-help/)
We will gladly answer any questions!
Remember that apart from this thread you can also contact us using the [FOSS Card Games group](https://groups.google.com/forum/#!forum/foss-card-games), and using the ##pysol chat room on [Freenode](http://freenode.net/) (note the double octothorpe/hash-sign/pound-sign).
A final note is that while we are using GitHub for version control, and accept
pull requests and issue reports, we are still hosting the main site and the
downloads on SourceForge.net. See [the explanation](https://www.reddit.com/r/Python/comments/8237i3/help_is_needed_in_preparing_a_windows_binary/dv84xxu/)
for details.
/r/Python
https://redd.it/8cnoou
[PySolFC](http://pysolfc.sourceforge.net/) is a free and open-source collection of over 1,000 card Solitaire and Mahjong games with many features and solver/analysis tools. It is almost [20 years old](http://solitaire.vegard2.net/pysol.html), and the current development efforts are concentrated on [the GitHub repository](https://github.com/shlomif/PySolFC).
The PySolFC developers are happy to announce a new stable release, 2.2.0, of PySolFC (the last one was in distant 2009!). Among the new features are:
* Compatibility with both Python 3.x and Python 2.7.
* Support for the Kivy user-interface toolkit, for Android devices and other systems.
* A Microsoft Windows binary installer.
* Support for dealing all [Freecell Pro deals](http://fc-solve.shlomifish.org/faq.html#what_are_ms_deals) by specifying "ms100000", or similar, as the seed.
* Support for the [Black Hole and All in a Row solver](http://www.shlomifish.org/open-source/projects/black-hole-solitaire-solver/) was added.
* Test suite and [CI](https://en.wikipedia.org/wiki/Continuous_integration) have been added to the repository.
* The code now passes [flake8](https://pypi.python.org/pypi/flake8) validation.
You can find [download links](https://sourceforge.net/projects/pysolfc/files/PySolFC/) for current Windows, source code, and Android versions.
Packages for Linux/BSD/etc. distributions and operating systems should be made
available soon from the downstream packagers.
Future plans:
* Vector-based fully scalable cards and graphics
* Large-scale cardsets for HD displays
* An online, WWW-based version
If you want to help, we need:
* Programmers
* Graphic designers who would help with improving the app’s look
* People to help with documentation and translations
* People who would spread the word
* Testers / QA people
* Monetary donations - see [this page](http://www.shlomifish.org/meta/how-to-help/)
We will gladly answer any questions!
Remember that apart from this thread you can also contact us using the [FOSS Card Games group](https://groups.google.com/forum/#!forum/foss-card-games), and using the ##pysol chat room on [Freenode](http://freenode.net/) (note the double octothorpe/hash-sign/pound-sign).
A final note is that while we are using GitHub for version control, and accept
pull requests and issue reports, we are still hosting the main site and the
downloads on SourceForge.net. See [the explanation](https://www.reddit.com/r/Python/comments/8237i3/help_is_needed_in_preparing_a_windows_binary/dv84xxu/)
for details.
/r/Python
https://redd.it/8cnoou
GitHub
GitHub - shlomif/PySolFC: A comprehensive, feature-rich, open source, and portable, collection of Solitaire games.
A comprehensive, feature-rich, open source, and portable, collection of Solitaire games. - shlomif/PySolFC
How can I dynamically change the file extension in a relative link from IPYNB to HTML when downloading a notebook as HTML?
I currently have a line inside a notebook (File1.ipynb):
[File 2](File2.ipynb)
When downloading both the files as HTML, this link is hard-coded, and hence when I click on the link in the generated *File1.html*, it can't find the file, because it refers to ipynb and not to html.
I could try:
* using sed to replace all occurrences of ipynb with html
* hard-coding html inside the notebook, which will prevent me from using the links when I'm editing the notebook.
But, is there an alternative?
Is there, perhaps, a way to specify two links inside the notebook such that if the browser fails to find the first one, it'll try the second? I tried searching for such a method. I couldn't find it.
/r/IPython
https://redd.it/8ct3ia
I currently have a line inside a notebook (File1.ipynb):
[File 2](File2.ipynb)
When downloading both the files as HTML, this link is hard-coded, and hence when I click on the link in the generated *File1.html*, it can't find the file, because it refers to ipynb and not to html.
I could try:
* using sed to replace all occurrences of ipynb with html
* hard-coding html inside the notebook, which will prevent me from using the links when I'm editing the notebook.
But, is there an alternative?
Is there, perhaps, a way to specify two links inside the notebook such that if the browser fails to find the first one, it'll try the second? I tried searching for such a method. I couldn't find it.
/r/IPython
https://redd.it/8ct3ia
reddit
How can I dynamically change the file extension in a... • r/IPython
I currently have a line inside a notebook (File1.ipynb): [File 2](File2.ipynb) When downloading both the files as HTML, this link is...
jQuery/AJAX get Request format?
I've got a post request working pretty well
$.post('/discount', {
time_left: distance / 60000,
ban_id: id
})
So say for example, with my get request, all I want to do is actually grab some data from Python Flask, namely in my /discount route I have a variable named d_code which is my discount code. All I simply want to do is grab this variable and in the function of the GET request, I want to change the innerHTML of a paragraph just to show the discount code.
Fairly simple, but I don't really understand how to do the get request correctly.
Bonus: Do you think a flask app with gunicorn can handle 10k-100k users a day? Hosted on Heroku.
/r/flask
https://redd.it/8crflf
I've got a post request working pretty well
$.post('/discount', {
time_left: distance / 60000,
ban_id: id
})
So say for example, with my get request, all I want to do is actually grab some data from Python Flask, namely in my /discount route I have a variable named d_code which is my discount code. All I simply want to do is grab this variable and in the function of the GET request, I want to change the innerHTML of a paragraph just to show the discount code.
Fairly simple, but I don't really understand how to do the get request correctly.
Bonus: Do you think a flask app with gunicorn can handle 10k-100k users a day? Hosted on Heroku.
/r/flask
https://redd.it/8crflf
reddit
jQuery/AJAX get Request format? • r/flask
I've got a post request working pretty well $.post('/discount', { time_left: distance / 60000, ban_id: id }) So say for example,...
Sending Email For Errors In Django - Stack Expressions
https://www.stackexpressions.com/sending-email-for-errors-django/
/r/djangolearning
https://redd.it/8cunbq
https://www.stackexpressions.com/sending-email-for-errors-django/
/r/djangolearning
https://redd.it/8cunbq
Stack Expressions
Sending Email For Errors In Django - Stack Expressions
Email notification is better for critical errors happening in our application. Because, we cannot open the application logs in the middle of the night. Django has a built in feature for sending emails in Django apps. AdminEmailHandler is meant to do the job…
[N] TensorFlow 1.8.0 Release Candidate Announced
https://github.com/tensorflow/tensorflow/releases/tag/v1.8.0-rc0
/r/MachineLearning
https://redd.it/8cq4gj
https://github.com/tensorflow/tensorflow/releases/tag/v1.8.0-rc0
/r/MachineLearning
https://redd.it/8cq4gj
GitHub
tensorflow/tensorflow
An Open Source Machine Learning Framework for Everyone - tensorflow/tensorflow
[AF] Delete table in Flask, using flask-sqlalchemy?
So, I want to delete a table in my database, this being a table called Comments as I know it will only make for a terribly scaled flask app. do I just delete the code for the model in models.py and make a migration?
Here is my models.py if anyone is interested:
https://github.com/ModoUnreal/dopenet/blob/master/app/models.py
/r/flask
https://redd.it/8conl9
So, I want to delete a table in my database, this being a table called Comments as I know it will only make for a terribly scaled flask app. do I just delete the code for the model in models.py and make a migration?
Here is my models.py if anyone is interested:
https://github.com/ModoUnreal/dopenet/blob/master/app/models.py
/r/flask
https://redd.it/8conl9
GitHub
ModoUnreal/dopenet
dopenet - The ideal template to make websites in 2018!!!! (I'm kidding of course)
What's the difference between Statsmodel's Poisson and GLM with Poisson family?
For Statsmodels (imported as sm), I do not know what the difference is between
sm.Poisson(Y,X)
vs
sm.GLM(Y,X,family=sm.families.Poisson())
Also, another oddity is that with the former I have to use fit_regularize but with the latter, if I try to fit_regularize, I will get None when I try to get a summary.
/r/pystats
https://redd.it/8crlvg
For Statsmodels (imported as sm), I do not know what the difference is between
sm.Poisson(Y,X)
vs
sm.GLM(Y,X,family=sm.families.Poisson())
Also, another oddity is that with the former I have to use fit_regularize but with the latter, if I try to fit_regularize, I will get None when I try to get a summary.
/r/pystats
https://redd.it/8crlvg
reddit
What's the difference between Statsmodel's Poisson and GLM with...
For Statsmodels (imported as sm), I do not know what the difference is...
Updating fields in another model with custom save
Hello,
I have a few models with custom save definitions. I am looking to update a field in one model when I save another model based on a date comparison between the two. Unfortunately, I can't get this to work. I was wondering if someone could check out my code and see what I'm doing wrong.
models.py
class Person(models.Model):
first_name = models.CharField(max_length=250)
relation_name = models.CharField(max_length=250, blank=True)
last_name = models.CharField(max_length=250)
village = models.ForeignKey(Village)
earliest_case = models.ForeignKey('Case', null=True, blank=True, related_name='person_to_earliest_case+')
latest_case = models.ForeignKey('Case', null=True, blank=True, related_name='person_to_latest_case+')
def save(self, *args, **kwargs):
try:
earliest_litigation = Case.objects.filter(litigants__person=self).order_by('session__date')[0]
except:
earliest_litigation = None
try:
earliest_pledge = Case.objects.filter(litigants__pledges__giver=self).order_by('receiver__case__session__date')[0]
except:
earliest_pledge = None
if earliest_litigation and earliest_pledge:
if earliest_litigation.session.date > earliest_pledge.session.date:
self.earliest_case = earliest_litigation
elif earliest_pledge.receiver.session.date > earliest_litigation.session.date:
self.earliest_case = earliest_pledge
elif earliest_litigation:
self.earliest_case = earliest_litigation
elif earliest_pledge:
self.earliest_case = earliest_pledge
else:
self.earliest_case = None
try:
latest_litigation = Case.objects.filter(litigants__person=self).order_by('-session__date')[0]
except:
latest_litigation = None
try:
latest_pledge = Case.objects.filter(litigants__pledges__giver=self).order_by('-receiver__case__session__date')[0]
except:
latest_pledge = None
if latest_litigation and latest_pledge:
if latest_litigation.session.date > latest_pledge.session.date:
self.latest_case = latest_litigation
elif latest_pledge.session.date > latest_litigation.session.date:
self.latest_case = latest_pledge
elif latest_litigation:
self.latest_case = latest_litigation
elif latest_pledge:
self.latest_case = latest_pledge
else:
self.latest_case = None
super(Person, self).save(*args, **kwargs)
class Litigant(models.Model):
person = models.ForeignKey(Person, on_delete=models.CASCADE, related_name='cases')
case = models.ForeignKey(Case, on_delete=models.CASCADE, related_name='litigants')
role = models.ForeignKey(Role, related_name='litigant_role')
def save(self, *args, **kwargs):
super(Litigant, self).save(*args, **kwargs)
person = Person.objects.get(pk=self.person)
earliest_litigation = person.earliest_case
latest_litigation = person.latest_case
if earliest_litigation:
if self.case.session.date < earliest_litigation.session.date:
person.earliest_case = self.case
person.save(update_fields=['earliest_case'])
if latest_litigation:
if self.case.session.date > latest_litigation.session.date:
person.latest_case = self.case
person.save(update_fields=['latest_case'])
else:
person.earliest_case = self.case
person.latest_case = self.case
person.save(update_fields=['earliest_case', 'latest_case'])
When I save a `Person` model instance it updates the `earliest` and `last` case references just fine. However, when I add them as a `Litigant` it doesn't up
Hello,
I have a few models with custom save definitions. I am looking to update a field in one model when I save another model based on a date comparison between the two. Unfortunately, I can't get this to work. I was wondering if someone could check out my code and see what I'm doing wrong.
models.py
class Person(models.Model):
first_name = models.CharField(max_length=250)
relation_name = models.CharField(max_length=250, blank=True)
last_name = models.CharField(max_length=250)
village = models.ForeignKey(Village)
earliest_case = models.ForeignKey('Case', null=True, blank=True, related_name='person_to_earliest_case+')
latest_case = models.ForeignKey('Case', null=True, blank=True, related_name='person_to_latest_case+')
def save(self, *args, **kwargs):
try:
earliest_litigation = Case.objects.filter(litigants__person=self).order_by('session__date')[0]
except:
earliest_litigation = None
try:
earliest_pledge = Case.objects.filter(litigants__pledges__giver=self).order_by('receiver__case__session__date')[0]
except:
earliest_pledge = None
if earliest_litigation and earliest_pledge:
if earliest_litigation.session.date > earliest_pledge.session.date:
self.earliest_case = earliest_litigation
elif earliest_pledge.receiver.session.date > earliest_litigation.session.date:
self.earliest_case = earliest_pledge
elif earliest_litigation:
self.earliest_case = earliest_litigation
elif earliest_pledge:
self.earliest_case = earliest_pledge
else:
self.earliest_case = None
try:
latest_litigation = Case.objects.filter(litigants__person=self).order_by('-session__date')[0]
except:
latest_litigation = None
try:
latest_pledge = Case.objects.filter(litigants__pledges__giver=self).order_by('-receiver__case__session__date')[0]
except:
latest_pledge = None
if latest_litigation and latest_pledge:
if latest_litigation.session.date > latest_pledge.session.date:
self.latest_case = latest_litigation
elif latest_pledge.session.date > latest_litigation.session.date:
self.latest_case = latest_pledge
elif latest_litigation:
self.latest_case = latest_litigation
elif latest_pledge:
self.latest_case = latest_pledge
else:
self.latest_case = None
super(Person, self).save(*args, **kwargs)
class Litigant(models.Model):
person = models.ForeignKey(Person, on_delete=models.CASCADE, related_name='cases')
case = models.ForeignKey(Case, on_delete=models.CASCADE, related_name='litigants')
role = models.ForeignKey(Role, related_name='litigant_role')
def save(self, *args, **kwargs):
super(Litigant, self).save(*args, **kwargs)
person = Person.objects.get(pk=self.person)
earliest_litigation = person.earliest_case
latest_litigation = person.latest_case
if earliest_litigation:
if self.case.session.date < earliest_litigation.session.date:
person.earliest_case = self.case
person.save(update_fields=['earliest_case'])
if latest_litigation:
if self.case.session.date > latest_litigation.session.date:
person.latest_case = self.case
person.save(update_fields=['latest_case'])
else:
person.earliest_case = self.case
person.latest_case = self.case
person.save(update_fields=['earliest_case', 'latest_case'])
When I save a `Person` model instance it updates the `earliest` and `last` case references just fine. However, when I add them as a `Litigant` it doesn't up
date their `earliest` or `last` case references as I was hoping the custom save method in `Litigant` model would do.
Am I missing something obvious here?
Thanks in advance for any help!
/r/django
https://redd.it/8cslex
Am I missing something obvious here?
Thanks in advance for any help!
/r/django
https://redd.it/8cslex
reddit
Updating fields in another model with custom save • r/django
Hello, I have a few models with custom save definitions. I am looking to update a field in one model when I save another model based on a date...