Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.8K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
Python Slack Community: PySlackers. 8,500 users strong

We have commented a couple times about our python slack community, but I would like to make an official post about it now.

We are PySlackers, a community driven slack group of ~8,500 users from all over the world and all levels of experience. We have popular channels for most topics people care about such as:

#flask
#django
#devops
#async
#beer_geeks

and even many based on location like `#i18n_nyc` and more.


We would like to invite you all to our great community. You can find our website over at https://pyslackers.com where you can find a big button to automatically join our community. We also have a few community projects (`#community_projects`) where we are working on the website (django) and a slack bot (aiohttp) and are talking about others.

You can also find us on github at:
https://github.com/pyslackers

If you want to give back to the community and want to learn how to build things. We are also open to new ideas.

So on behalf of the other admins, we invite you all to join, and grow with us and the rest of the community and write some python!

Shawn (autoferrit)

/r/Python
https://redd.it/6yh5uy
I'm being followed by an army of spammy Python accounts on Twitter. What's going on?

Over the last few days a number of suspicious looking accounts have started to follow me on twitter. They all pretend to be some sort of generic Python related account. Yet they all have more or less the same bio and all tweets link to very suspicious websites.

I've blocked and reported all of them, but more and more are coming and I'm seeing legitimate Python accounts following some of them, probably without double checking.

Did anyone else notice this? Does anyone have an idea of what's going on? Should I report this to twitter and if yes how?

Here's a list of the accounts I've seen so far if someone want's to check them out. **Be careful with clicking any of the links in their tweets and bio!**

* [@learn_pythonx](https://www.twitter.com/learn_pythonx)
* [@python_codecs](https://www.twitter.com/python_codecs)
* [@PythonCodeademy](https://www.twitter.com/PythonCodeademy)
* [@The_PythonTutor](https://www.twitter.com/The_PythonTutor)
* [@Python_Codingz](https://www.twitter.com/Python_Codingz)
* [@Python_4coders](https://www.twitter.com/Python_4coders)
* [@Learn_Python_2z](https://www.twitter.com/Learn_Python_2z)
* [@python_0toHero](https://www.twitter.com/python_0toHero)
* [@ThePythonTutor_](https://www.twitter.com/ThePythonTutor_)
* [@python_4coder](https://www.twitter.com/python_4coder)
* [@Python\_Master_](https://www.twitter.com/Python_Master_)
* [@Python_programz](https://www.twitter.com/Python_programz)
* [@pythonbeginner_](https://www.twitter.com/pythonbeginner_)
* [@PythonsTraining](https://www.twitter.com/PythonsTraining)
* [@LearnsPython](https://www.twitter.com/LearnsPython)
* [@PythonDailyNews](https://www.twitter.com/PythonDailyNews)
* [@python_news_4u](https://www.twitter.com/python_news_4u)
* [@python\_academy_](https://www.twitter.com/python_academy_)
* [@pythonmaster_](https://www.twitter.com/pythonmaster_)
* [@PythonDev_AtoZ](https://www.twitter.com/PythonDev_AtoZ)
* [@LearnPython_toZ](https://www.twitter.com/LearnPython_toZ)
* [@Python_AtoZ](https://www.twitter.com/Python_AtoZ)
* [@Python4Tutorial](https://www.twitter.com/Python4Tutorial)

/r/Python
https://redd.it/7wl2hc
Using SelectFields with flask-wtforms !HELP!

I'm having issues using Select Field in flask . I'm unable to submit get data from the select fields , also when i use them with normal input fields none of the fields return any data . But the input fields work and return data if I remove the selectFields . Here's the code :

Models and form :

class City(db.Model):
id = db.Column(db.Integer, primary\_key=True)
city = db.Column(db.String(30), unique=True, nullable=False)
state = db.Column(db.String(30), nullable=False)
country = db.Column(db.String(30), nullable=False)
class CityForm(FlaskForm):
city = StringField('city', validators=\[InputRequired()\])
state = SelectField('state' , validators=\[InputRequired()\] , coerce = str)
country = SelectField('country' , validators=\[InputRequired()\] , coerce = str)

the select fields are populated in the views , like this :

form\_city.state.choices = \[(row\[0\],row\[0\]) for row in db.session.query(login\_model.State.state)\]
form\_city.country.choices = \[(row\[0\],row\[0\]) for row in db.session.query(login\_model.Country.country)\]

\~\~\~\~\~

if form\_city.validate\_on\_submit():
mssg = ""
prod = login\_model.City.query.filter\_by(city=form\_city.city.data).first()
print('okaaay')
if prod :
mssg = "Duplicate Data "
flash(mssg)
return redirect(url\_for('basic\_master'))
else:
new\_data = login\_model.City(city=form\_city.city.data.upper())
try:
db.session.add(new\_data)
db.session.commit()
mssg = "Data Successfully added 👍"
flash(mssg)
return redirect(url\_for('basic\_master'))

except Exception as e:
mssg = "Error occured while adding data 😵. Here's the error : "+str(e)
flash(mssg)
return redirect(url\_for('basic\_master'))
Nothing works if I have selectfields in my Form class , and If i remove them the normal input field works .

Any help is much appreciated thanks.

\#flask #sqlalchemy #wtforms #python

/r/flask
https://redd.it/8srquo
Flask-JWT-Extended looking for maintainers.

I am looking to get a couple maintainers for flask-jwt-extended and the sister project, flask-jwt-simple. I will still be actively maintaining this repo as well, but I want to make sure it never ends up abandoned (like flask-jwt), and have safeguards in the off chance that I get hit by a bus :)

The primary responsibilities of a maintainer would be code reviews and helping with issues that come in. All these are pretty low traffic so it shouldn't be much work. If you're interested or have more questions, please let me know in https://github.com/vimalloc/flask-jwt-extended/issues/194 or in the #flask-jwt-extended irc channel on freenode.

Cheers 👍

/r/Python
https://redd.it/9gc7s4
Initializing a Flask app

[https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world](https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world)


With the above tutorial an `app` package is created. For the `__init__.py` file, `Flask` is instantiated in there:

app/__init__.py: Flask application instance

from flask import Flask

app = Flask(__name__)

from app import routes

Why is that written in \`\_\_init\_\_.py\` and what is the benefit of that? As opposed to an empty `__init__.py` and then instantiating the `Flask` class in another module such as...


app/main_app.py #Flask is instantiated here instead of __init__.py

from flask import Flask

app = Flask(__name__)


​

/r/flask
https://redd.it/aqoq8m
Need clarification regarding 'g' in Flask

[http://flask.pocoo.org/docs/1.0/api/#flask.g](http://flask.pocoo.org/docs/1.0/api/#flask.g)

In trying to interpret the usage of **g** in Flask *as a novice*, I'm reading that it's an object to store data for the duration of an application context.

* *What types of data should be stored under this object?*
* *Why would the data be better suited under this object namespace? Rather, why not just explicitly call out what is needed at the application level? (An example being g.db.connect() vs database.connect())*

Please provide details/explanations on how to make the best use of this object.

/r/flask
https://redd.it/bub9pk
New Fask library to make uploading, storing & streaming files easy!

Hi guys

I have just finished work on a new Flask library to make uploading files and storing them on your server & database as easy as possible... just let Flask-File-Upload handle all the repetitive work!

Works with Flask & Flask-SQLAlchemy

[https://github.com/joegasewicz/Flask-File-Upload](https://github.com/joegasewicz/Flask-File-Upload)

​

I would be very grateful if anyone wishes to try out this library & or give some feed back. And of course contributions are welcome!

Thanks so much

Joe

​

https://preview.redd.it/ppd6fr092g941.jpg?width=2200&format=pjpg&auto=webp&s=9fe80a5d18d313158672805eddb42edbfd1de506

\#python #flask #sqlalchemy

/r/flask
https://redd.it/elk36d
A new Flask library to help make authenticating users super easy! Login users with ease :)

I'm releasing v0.1.0 this weekend of a Flask library that helps to make logging in users super easy!

If you want to develop Flasks app's fast & not spend all your time solving authorisation of all your resources / requests, then maybe this library can be useful for you..

Works out of the box with Flask-SQLAlchemy, so after you set up a user model with Flask-JWT-Router you no longer have to worry about handling any authenticating of that user or authorising routes associated with that users allowed resource access...

[https://github.com/joegasewicz/flask-jwt-router](https://github.com/joegasewicz/flask-jwt-router)

Could be useful for SPA's like AngularJS & ReactJS

Thank you very much for your time,

Joe

https://preview.redd.it/p8mxk63zm7e41.png?width=2506&format=png&auto=webp&s=0e231bc93f36b1f31557ea3e88627e50fe1bdf44

​

\#Python #ReactJS #Flask #SLQAlchemy #JWT

/r/flask
https://redd.it/ewy5sm
FlaskEase - Flask extension for creating REST APIs and OpenAPI docs with ease, inspired from FastAPI.

Yet another [\#Flask](https://twitter.com/hashtag/Flask?src=hashtag_click) REST API extension(mine is experimental) -> [https://github.com/zero-shubham/flask-ease](https://github.com/zero-shubham/flask-ease) inspired from [@tiangolo](https://twitter.com/tiangolo)'s [\#Fastapi](https://twitter.com/hashtag/Fastapi?src=hashtag_click)

/r/flask
https://redd.it/hp6rha