This seems a very helpful validator for Flask API servers
https://github.com/alecthomas/voluptuous
/r/flask
https://redd.it/8p83v8
https://github.com/alecthomas/voluptuous
/r/flask
https://redd.it/8p83v8
GitHub
GitHub - alecthomas/voluptuous: CONTRIBUTIONS ONLY: Voluptuous, despite the name, is a Python data validation library.
CONTRIBUTIONS ONLY: Voluptuous, despite the name, is a Python data validation library. - alecthomas/voluptuous
Face tracking anime girl with proximity detection
https://v.redd.it/xna7lmmjwk211
/r/Python
https://redd.it/8pa8ff
https://v.redd.it/xna7lmmjwk211
/r/Python
https://redd.it/8pa8ff
reddit
Face tracking anime girl with proximity detection • r/Python
33 points and 9 comments so far on reddit
React & Django TUTORIAL Integration // REACTify Django
https://www.youtube.com/watch?v=AHhQRHE8IR8
/r/django
https://redd.it/8pb6d4
https://www.youtube.com/watch?v=AHhQRHE8IR8
/r/django
https://redd.it/8pb6d4
YouTube
React & Django TUTORIAL Integration // REACTify Django
Integrate REACT & DJANGO with this tutorial.
Code: https://github.com/codingforentrepreneurs/Reactify-Django
Project: https://kirr.co/twdy04
Blog Post: https://kirr.co/saru2p
Sections
1 - Welcome (0:00:00)
2 - Walkthrough (0:01:22)
3 - Requirements (0:04:05)…
Code: https://github.com/codingforentrepreneurs/Reactify-Django
Project: https://kirr.co/twdy04
Blog Post: https://kirr.co/saru2p
Sections
1 - Welcome (0:00:00)
2 - Walkthrough (0:01:22)
3 - Requirements (0:04:05)…
[AF] How to sort SQLAlchemy query by number of many to many relationships
Hello!
I have two tables which I've simplified below. A post model and a post likes model. When I want to create a like on a post, I create an instance of a post like which holds a backreference to the post in question.
I would like to perform a query that will grab all my posts and sort them by number of likes. However, because I'm still a bit green when it comes to SQLAlchemy, I'm not sure how to sort by number of many to many relationships (self\_likes).
class PostLike(db.Model):
post_id = db.Column("post_id", db.Integer, db.ForeignKey("post.id"),
primary_key=True)
class Post(db.Model):
_tablename_ = "post"
id = db.Column(db.Integer, primary_key=True)
self_likes = db.relationship("PostLike", backref="self_likes", lazy="dynamic", foreign_keys="PostLike.post_id")
Any help would be greatly appreciated!
/r/flask
https://redd.it/8p5wn6
Hello!
I have two tables which I've simplified below. A post model and a post likes model. When I want to create a like on a post, I create an instance of a post like which holds a backreference to the post in question.
I would like to perform a query that will grab all my posts and sort them by number of likes. However, because I'm still a bit green when it comes to SQLAlchemy, I'm not sure how to sort by number of many to many relationships (self\_likes).
class PostLike(db.Model):
post_id = db.Column("post_id", db.Integer, db.ForeignKey("post.id"),
primary_key=True)
class Post(db.Model):
_tablename_ = "post"
id = db.Column(db.Integer, primary_key=True)
self_likes = db.relationship("PostLike", backref="self_likes", lazy="dynamic", foreign_keys="PostLike.post_id")
Any help would be greatly appreciated!
/r/flask
https://redd.it/8p5wn6
reddit
r/flask - [AF] How to sort SQLAlchemy query by number of many to many relationships
1 votes and 9 so far on reddit
Python Application Layouts: A Reference
https://realpython.com/python-application-layouts/
/r/Python
https://redd.it/8pe0j5
https://realpython.com/python-application-layouts/
/r/Python
https://redd.it/8pe0j5
Realpython
Python Application Layouts: A Reference – Real Python
A reference guide to common Python application layouts and project structures for command-line applications, web applications, and more.
How to Build Chat into Django Applications with Twilio Programmable Chat
https://www.twilio.com/blog/2018/05/build-chat-python-django-applications-programmable-chat.html
/r/django
https://redd.it/8pcqr1
https://www.twilio.com/blog/2018/05/build-chat-python-django-applications-programmable-chat.html
/r/django
https://redd.it/8pcqr1
Twilio Blog
How to Build Chat into Django Applications with Twilio Programmable Chat
Learn how to integrate advanced chat features into your Python Django web application using Twilio Programmable Chat.
Jupyter temp files not being deleted question.
Hi Everyone,
On my work PC, I run Jupyter 5.4.0, usually through Anaconda Navigator. I have always had an issue where the temp files created during a session do not get deleted. These are located in my AppData\Local\temp folder. The size of each of the files is 0 bytes, but, if I let it go for a few days, I can get thousands of 0 bytes files. I believe it is related to Jupyter but I am not 100% certain. I know that if I run Python through any other IDE I don't see the same thing. Is there a way to tell if this is a result of Jupyter? More importantly, if it is, how do I configure it to stop this?
Thanks for the input!
/r/IPython
https://redd.it/8pelmg
Hi Everyone,
On my work PC, I run Jupyter 5.4.0, usually through Anaconda Navigator. I have always had an issue where the temp files created during a session do not get deleted. These are located in my AppData\Local\temp folder. The size of each of the files is 0 bytes, but, if I let it go for a few days, I can get thousands of 0 bytes files. I believe it is related to Jupyter but I am not 100% certain. I know that if I run Python through any other IDE I don't see the same thing. Is there a way to tell if this is a result of Jupyter? More importantly, if it is, how do I configure it to stop this?
Thanks for the input!
/r/IPython
https://redd.it/8pelmg
reddit
Jupyter temp files not being deleted question. • r/IPython
Hi Everyone, On my work PC, I run Jupyter 5.4.0, usually through Anaconda Navigator. I have always had an issue where the temp files created...
Override Flask Login to use Request Loader
So here's my situation, I have an app which I can't edit, but I can add code to it. At the moment it uses Flask Login for user management/authentication. I want to use Flask Login's Request Loader.
I want to use one of AWS"s new features where I can authenticate on an Application Load Balancer, which will pass the user information to my application via headers. I therefore want to inspect the headers and either create a session on the server for that user, or check the session and continue with the request if the user already has a session.
So my question is this, how would I go about overriding the current implementation of Flask Login? I know I can use decorators to do this, I just don't know which methods to override.
I basically know that this is possible, based on the docs, but I have no clue how to implement it.
/r/flask
https://redd.it/8p0tzn
So here's my situation, I have an app which I can't edit, but I can add code to it. At the moment it uses Flask Login for user management/authentication. I want to use Flask Login's Request Loader.
I want to use one of AWS"s new features where I can authenticate on an Application Load Balancer, which will pass the user information to my application via headers. I therefore want to inspect the headers and either create a session on the server for that user, or check the session and continue with the request if the user already has a session.
So my question is this, how would I go about overriding the current implementation of Flask Login? I know I can use decorators to do this, I just don't know which methods to override.
I basically know that this is possible, based on the docs, but I have no clue how to implement it.
/r/flask
https://redd.it/8p0tzn
reddit
r/flask - Override Flask Login to use Request Loader
1 votes and 0 so far on reddit
What does """ do?
Automate the Boring Stuff has a program that changes American dates to European dates. The first part of the code goes:
datePattern = re.compile(r"""\^(.\*?)
#one or two digits for the month
((0|1)?\\d)\-
#one or two dgits for the day
((0|1|2|3)?\\d)\-
#four digits for the year
((19|20)\\d\\d)
#all text after the date
(.\*?)$
""", re.VERBOSE)
I have a pretty vague idea of what everything does except for the r"""\^ part on the first line. what does """ do?
/r/Python
https://redd.it/8pghas
Automate the Boring Stuff has a program that changes American dates to European dates. The first part of the code goes:
datePattern = re.compile(r"""\^(.\*?)
#one or two digits for the month
((0|1)?\\d)\-
#one or two dgits for the day
((0|1|2|3)?\\d)\-
#four digits for the year
((19|20)\\d\\d)
#all text after the date
(.\*?)$
""", re.VERBOSE)
I have a pretty vague idea of what everything does except for the r"""\^ part on the first line. what does """ do?
/r/Python
https://redd.it/8pghas
reddit
r/Python - What does """ do?
3 votes and 1 so far on reddit
Building large application using Flask, Celery with https://github.com/gofynd/flask-full
Flask\-Full \([https://github.com/gofynd/flask\-full](https://github.com/gofynd/flask-full)\) is a boilerplate framework on top of flask for developing large applications using flask. It has in built support for shell commands, celery, websocket, eventlet, signals, mongoengine orm and rst docs. One can also have separate staging, production config.
/r/flask
https://redd.it/8ng29z
Flask\-Full \([https://github.com/gofynd/flask\-full](https://github.com/gofynd/flask-full)\) is a boilerplate framework on top of flask for developing large applications using flask. It has in built support for shell commands, celery, websocket, eventlet, signals, mongoengine orm and rst docs. One can also have separate staging, production config.
/r/flask
https://redd.it/8ng29z
GitHub
GitHub - gofynd/flask-full: starter/boilerplate flask application with celery, mongoengine, signals, shell commands, swagger api…
starter/boilerplate flask application with celery, mongoengine, signals, shell commands, swagger api docs and sphinx docs integration - gofynd/flask-full
Want to learn to populate Django objects with JSON data
I've got a web scraper that returns some basic JSON data, and I've got a Django site that has models roughly corresponding to that data.
I've googled all over for tutorials on how to do populate my Django model with JSON data, and there's lots of people with partial explanations, but nobody with a full tutorial.
I know django-dynamic-scraper exists, but its documentation is not clear enough to get it working. I've been struggling with this for a few weeks now. Anybody have experience with this? Any chance there's a good tutorial I missed somewhere?
/r/djangolearning
https://redd.it/8pcz6y
I've got a web scraper that returns some basic JSON data, and I've got a Django site that has models roughly corresponding to that data.
I've googled all over for tutorials on how to do populate my Django model with JSON data, and there's lots of people with partial explanations, but nobody with a full tutorial.
I know django-dynamic-scraper exists, but its documentation is not clear enough to get it working. I've been struggling with this for a few weeks now. Anybody have experience with this? Any chance there's a good tutorial I missed somewhere?
/r/djangolearning
https://redd.it/8pcz6y
reddit
r/djangolearning - Want to learn to populate Django objects with JSON data
3 votes and 2 so far on reddit
How to use Pygments Syntax Highlighter
https://overiq.com/blog/1527072795/pygments-tutorial/
/r/django
https://redd.it/8pgmg0
https://overiq.com/blog/1527072795/pygments-tutorial/
/r/django
https://redd.it/8pgmg0
[P] Playing card detection with YOLOv3 trained on generated dataset
https://youtu.be/pnntrewH0xg
/r/MachineLearning
https://redd.it/8p9car
https://youtu.be/pnntrewH0xg
/r/MachineLearning
https://redd.it/8p9car
YouTube
Playing card detection with YOLO
Detection of playing cards with Darknet-YOLO (version 3) trained on a generated dataset
The code for generating the dataset is available here : https://github.com/geaxgx/playing-card-detection
Darknet/YOLO from : https://github.com/AlexeyAB/darknet
Image…
The code for generating the dataset is available here : https://github.com/geaxgx/playing-card-detection
Darknet/YOLO from : https://github.com/AlexeyAB/darknet
Image…
diskover - file system crawler, disk space usage, storage analytics
https://shirosaidev.github.io/diskover
/r/Python
https://redd.it/8pgy3n
https://shirosaidev.github.io/diskover
/r/Python
https://redd.it/8pgy3n
diskover
File system crawler, file search engine and data management and analytics software powered by Elasticsearch to help visualize and manage your data.
Return Image as API response.
What is the best way to return image from flask API to fetch in mobile/web app? I was thinking to develop a react app which will call api and get a response with filename and it will return image from file system? Is this how its done, i don't have much idea about react just starting personal project.
/r/flask
https://redd.it/8pj0bg
What is the best way to return image from flask API to fetch in mobile/web app? I was thinking to develop a react app which will call api and get a response with filename and it will return image from file system? Is this how its done, i don't have much idea about react just starting personal project.
/r/flask
https://redd.it/8pj0bg
reddit
r/flask - Return Image as API response.
2 votes and 6 so far on reddit
REST framework based on Flask. Easy to use and well organized.
https://github.com/laith43d/juju
/r/flask
https://redd.it/8nl79t
https://github.com/laith43d/juju
/r/flask
https://redd.it/8nl79t
GitHub
laith43d/juju
REST application framework based on Flask. Contribute to laith43d/juju development by creating an account on GitHub.
Controlling A Cruise Ship’s Massive Video Display with Python
https://www.twilio.com/blog/2018/02/control-nec-display-array-python.html?src=reddit
/r/Python
https://redd.it/8pjxgq
https://www.twilio.com/blog/2018/02/control-nec-display-array-python.html?src=reddit
/r/Python
https://redd.it/8pjxgq
Wpengine
Controlling A Cruise Ship’s Massive Video Display with Python – Twilio Cloud Communications Blog
Sasa Buklijas built a 34-screen virtual waterfall out of an array of NEC displays, and used Python to control it all. We cover the Python code behind the installation, some of the lessons learned, and include video and images for you to use in your own install.
[AF] Trouble with Flask and using ajax to dynamically refresh
I'm very new to this so I'm really unsure why this doesn't work as I was following the answer to [this question](https://stackoverflow.com/questions/15721679/update-and-render-a-value-from-flask-periodically/). I'm trying to post a form to flask where I process it as needed. This part works fine but when I'm trying to return it back to my html file I notice the $.getJSON part simply doesn't run. Any help or advice is appreciated.
The form part in my index.html:
<!-- POST Form -->
<form action='/endpoint' name="entry" id="entry" method="POST" target="_blank">
<textarea placeholder="Enter Cipher..." id="input" type="text" name="entry" class="inputbox">{{original_text}}</textarea>
<br />
<br />
<input type="submit" class="form__button" value="DECRYPT" onclick="decrypt_click()" />
<br />
<br />
</form>
<textarea id="output" type="text" name="output" class="inputbox" readonly>{{deciphered_text}}</textarea>
Javascript in my html file:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript">
function update_values() {
$SCRIPT_ROOT = {{ request.script_root|tojson|safe }};
$.getJSON(
$SCRIPT_ROOT+"/endpoint",
function(data) {
$("textarea#output").val(data.deciphered_text)
$("textarea#entry").val(data.deciphered_text)
}
);
setTimeout(update_values, 1000);
}
update_values()
</script>
My ____init____.py:
from flask import Flask, render_template, request, jsonify, redirect, url_for
import sys
app = Flask(__name__)
from FlaskApp.autocrack import crack_vigenere, crack_caesar, crack_substitution, crack_beaufort, crack_2x2hill, crack_3x3hill, crack_bifid
import re
@app.route('/')
def homepage():
return render_template('index.html',deciphered_text="",original_text="",checkbox_status="1")
@app.route('/endpoint', methods=['GET','POST'])
def entry():
if request.method == 'POST':
text_orig = request.form['entry']
text = removeFormatting(text_orig)
cipher = request.form.get('cipher_selection_menu')
cipher = request.form['selection']
if text != "":
processed_text = text.upper()
if cipher == "1":
deciphered_text = crack_caesar(processed_text)
elif cipher == "2":
deciphered_text = crack_vigenere(processed_text)
elif cipher == "3":
timeout = request.form['timeout_slider']
deciphered_text = crack_substitution(processed_text,timeout)
elif cipher == "4":
deciphered_text = crack_beaufort(processed_text)
elif cipher == "5":
type = request.form['selector']
if type == "2":
deciphered_text = crack_2x2hill(processed_text)
elif type == "3":
deciphered_text = crack_3x3hill(processed_text)
elif cipher == "6":
deciphered_text = crack_bifid(processed_text)
return jsonify(deciphered_text=deciphered_text,original_text=text_orig)
return redirect(url_for('homepage'))
def removeFormatting(stringf):
return re.sub("[^a-zA-Z]+", "", stringf)
if __name__ == "__main__":
#app.run()
app.run(threaded=True)
/r/flask
https://redd.it/8pn4uu
I'm very new to this so I'm really unsure why this doesn't work as I was following the answer to [this question](https://stackoverflow.com/questions/15721679/update-and-render-a-value-from-flask-periodically/). I'm trying to post a form to flask where I process it as needed. This part works fine but when I'm trying to return it back to my html file I notice the $.getJSON part simply doesn't run. Any help or advice is appreciated.
The form part in my index.html:
<!-- POST Form -->
<form action='/endpoint' name="entry" id="entry" method="POST" target="_blank">
<textarea placeholder="Enter Cipher..." id="input" type="text" name="entry" class="inputbox">{{original_text}}</textarea>
<br />
<br />
<input type="submit" class="form__button" value="DECRYPT" onclick="decrypt_click()" />
<br />
<br />
</form>
<textarea id="output" type="text" name="output" class="inputbox" readonly>{{deciphered_text}}</textarea>
Javascript in my html file:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript">
function update_values() {
$SCRIPT_ROOT = {{ request.script_root|tojson|safe }};
$.getJSON(
$SCRIPT_ROOT+"/endpoint",
function(data) {
$("textarea#output").val(data.deciphered_text)
$("textarea#entry").val(data.deciphered_text)
}
);
setTimeout(update_values, 1000);
}
update_values()
</script>
My ____init____.py:
from flask import Flask, render_template, request, jsonify, redirect, url_for
import sys
app = Flask(__name__)
from FlaskApp.autocrack import crack_vigenere, crack_caesar, crack_substitution, crack_beaufort, crack_2x2hill, crack_3x3hill, crack_bifid
import re
@app.route('/')
def homepage():
return render_template('index.html',deciphered_text="",original_text="",checkbox_status="1")
@app.route('/endpoint', methods=['GET','POST'])
def entry():
if request.method == 'POST':
text_orig = request.form['entry']
text = removeFormatting(text_orig)
cipher = request.form.get('cipher_selection_menu')
cipher = request.form['selection']
if text != "":
processed_text = text.upper()
if cipher == "1":
deciphered_text = crack_caesar(processed_text)
elif cipher == "2":
deciphered_text = crack_vigenere(processed_text)
elif cipher == "3":
timeout = request.form['timeout_slider']
deciphered_text = crack_substitution(processed_text,timeout)
elif cipher == "4":
deciphered_text = crack_beaufort(processed_text)
elif cipher == "5":
type = request.form['selector']
if type == "2":
deciphered_text = crack_2x2hill(processed_text)
elif type == "3":
deciphered_text = crack_3x3hill(processed_text)
elif cipher == "6":
deciphered_text = crack_bifid(processed_text)
return jsonify(deciphered_text=deciphered_text,original_text=text_orig)
return redirect(url_for('homepage'))
def removeFormatting(stringf):
return re.sub("[^a-zA-Z]+", "", stringf)
if __name__ == "__main__":
#app.run()
app.run(threaded=True)
/r/flask
https://redd.it/8pn4uu
Stack Overflow
Update and render a value from Flask periodically
I want to display my CPU usage dynamically. I don't want to reload the page to see a new value. I know how to get the CPU usage in Python. Right now I render a template with the value. How can I
[AF] Ext to show flask cli commands as a web app?
I don't know if I was dreaming or just making things up.
But I believe there is somewhere a flask ext that gives you a kind of a menu as a web app to enter parameters and then execute the flask.cli function?
Any thoughts or opinions?
/r/flask
https://redd.it/8pmwyu
I don't know if I was dreaming or just making things up.
But I believe there is somewhere a flask ext that gives you a kind of a menu as a web app to enter parameters and then execute the flask.cli function?
Any thoughts or opinions?
/r/flask
https://redd.it/8pmwyu
reddit
r/flask - [AF] Ext to show flask cli commands as a web app?
2 votes and 1 so far on reddit