Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
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