As promised - webcam to ascii in command line
There's this [cool project](https://www.reddit.com/r/Python/comments/amjko2/works_with_live_webcam_video_idea_u1991viet/) which takes in camera input and converts it in real time to ascii art. The only problem is that it renders to a Pygame window instead of command line. (It was thought that rendering in text would be too slow.) I made some changes so it uses curses to render to command line.
So [as promised](https://www.reddit.com/r/Python/comments/amjko2/works_with_live_webcam_video_idea_u1991viet/efoti7v/?context=3) I making a post here, complete with a [youtube demo](https://www.youtube.com/watch?v=M0DnibYHUkQ), some [junky code](https://gist.github.com/SamyBencherif/29a0a945cabff92a4b61d78a5fe072a5) for you to get started on, and a bunch of [dumb embedded links](https://www.reddit.com/r/Python/comments/aswvve/as_promised_webcam_to_ascii_in_command_line/).
​
Installation of dependencies. Copy paste this into your terminal:
python3 -m pip install opencv-python
​
/r/Python
https://redd.it/aswvve
There's this [cool project](https://www.reddit.com/r/Python/comments/amjko2/works_with_live_webcam_video_idea_u1991viet/) which takes in camera input and converts it in real time to ascii art. The only problem is that it renders to a Pygame window instead of command line. (It was thought that rendering in text would be too slow.) I made some changes so it uses curses to render to command line.
So [as promised](https://www.reddit.com/r/Python/comments/amjko2/works_with_live_webcam_video_idea_u1991viet/efoti7v/?context=3) I making a post here, complete with a [youtube demo](https://www.youtube.com/watch?v=M0DnibYHUkQ), some [junky code](https://gist.github.com/SamyBencherif/29a0a945cabff92a4b61d78a5fe072a5) for you to get started on, and a bunch of [dumb embedded links](https://www.reddit.com/r/Python/comments/aswvve/as_promised_webcam_to_ascii_in_command_line/).
​
Installation of dependencies. Copy paste this into your terminal:
python3 -m pip install opencv-python
​
/r/Python
https://redd.it/aswvve
reddit
Works with live webcam video (idea: u/1991viet)
Posted in r/Python by u/Kuerbiskernkeks • 435 points and 60 comments
Downloadable Python lessons for someone cut off from the world for three weeks
I will be onboard onboard a ship out to sea for three weeks and internet access will be limited to email. Are there any good Python books/lessons that I can download and study during my downtime while I am out? I have absolutely no programming background.
/r/Python
https://redd.it/asyr69
I will be onboard onboard a ship out to sea for three weeks and internet access will be limited to email. Are there any good Python books/lessons that I can download and study during my downtime while I am out? I have absolutely no programming background.
/r/Python
https://redd.it/asyr69
reddit
r/Python - Downloadable Python lessons for someone cut off from the world for three weeks
4 votes and 6 comments so far on Reddit
Pure python website cloning library
https://github.com/rajatomar788/pywebcopy
/r/Python
https://redd.it/asztne
https://github.com/rajatomar788/pywebcopy
/r/Python
https://redd.it/asztne
GitHub
GitHub - rajatomar788/pywebcopy: Locally saves webpages to your hard disk with images, css, js & links as is.
Locally saves webpages to your hard disk with images, css, js & links as is. - rajatomar788/pywebcopy
CMS For User-Generated Graphs
I’m working on a project that allows a user to create academic articles with user generated graphs. Theoretically, the user would add a csv or excel spreadsheet in their publication and a CMS like Wagtail or Django CMS would generate a graph using React or Chart.js. Is this currently possible in Django with a CMS?
/r/django
https://redd.it/at352k
I’m working on a project that allows a user to create academic articles with user generated graphs. Theoretically, the user would add a csv or excel spreadsheet in their publication and a CMS like Wagtail or Django CMS would generate a graph using React or Chart.js. Is this currently possible in Django with a CMS?
/r/django
https://redd.it/at352k
reddit
r/django - CMS For User-Generated Graphs
0 votes and 2 comments so far on Reddit
IPython alias to preload your favorite modules and activate autoreload
https://towardsdatascience.com/tips-ipython-d5ea85c5e9be
/r/Python
https://redd.it/at3ikz
https://towardsdatascience.com/tips-ipython-d5ea85c5e9be
/r/Python
https://redd.it/at3ikz
Medium
IPython Alias to Preload Your Favorite Modules and Activate Autoreload
Grab your own powerful IPython with a very simple way
IPython 7.3 and 7.4 release announcements
https://discourse.jupyter.org/t/release-of-ipython-7-3/409
/r/IPython
https://redd.it/at45rk
https://discourse.jupyter.org/t/release-of-ipython-7-3/409
/r/IPython
https://redd.it/at45rk
Jupyter Community Forum
Release of IPython 7.3
Hi all, IPython 7.3 was released 2 days ago, and is now available on PyPI, and on conda-forge. You can update with pip install ipython --upgrade And if you are using conda, once available on conda-forge: conda upgrade ipython This is a smallish release…
html → mysql → flask → html
i'm trying to create an offline backup for this forum.. by using selenium to get all of the html from each post, put it into a mysql db, then redisplay the html when the post gets opened.. however when attempting the display the html is simply shows the html in [plain text](https://imgur.com/a/qDKQjVg), while if I copy the html and paste into an actual .html file and view it, everything [looks fine](https://imgur.com/a/KVoKb6S) (granted I don't have the css linked yet)
c.execute('SELECT * FROM posts WHERE post_id=%s', (post_id, ))
for i in c.fetchall():
title = i[0]
body = i[1]
return render_template('topic.html', body=body)
I also tried below, however it resulted in a `UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 426: ordinal not in range(128)` which after an hour of looking I still haven't found out why it actually errors out.. as .encoding('utf8') doesn't do anything..
return """
/r/flask
https://redd.it/at2p76
i'm trying to create an offline backup for this forum.. by using selenium to get all of the html from each post, put it into a mysql db, then redisplay the html when the post gets opened.. however when attempting the display the html is simply shows the html in [plain text](https://imgur.com/a/qDKQjVg), while if I copy the html and paste into an actual .html file and view it, everything [looks fine](https://imgur.com/a/KVoKb6S) (granted I don't have the css linked yet)
c.execute('SELECT * FROM posts WHERE post_id=%s', (post_id, ))
for i in c.fetchall():
title = i[0]
body = i[1]
return render_template('topic.html', body=body)
I also tried below, however it resulted in a `UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 426: ordinal not in range(128)` which after an hour of looking I still haven't found out why it actually errors out.. as .encoding('utf8') doesn't do anything..
return """
/r/flask
https://redd.it/at2p76
Imgur
Post with 1 views.
Polystores is a python abstraction and a collection of clients to interact with cloud storages.
https://github.com/polyaxon/polystores
/r/django
https://redd.it/at5nr5
https://github.com/polyaxon/polystores
/r/django
https://redd.it/at5nr5
GitHub
polyaxon/polystores
Polystores is an abstraction and a collection of clients to interact with cloud storages. - polyaxon/polystores
User-defined number of wtform forms
I need to be able generate a user defined number of forms for the user to input data into. I.E if the user wants 4 instances of this "thing" then they need 4 separate instances of the form on the page. Does anyone know how to achieve such a thing in flask using WTForms? Any help is appreciated!
/r/flask
https://redd.it/at7a4q
I need to be able generate a user defined number of forms for the user to input data into. I.E if the user wants 4 instances of this "thing" then they need 4 separate instances of the form on the page. Does anyone know how to achieve such a thing in flask using WTForms? Any help is appreciated!
/r/flask
https://redd.it/at7a4q
reddit
r/flask - User-defined number of wtform forms
0 votes and 2 comments so far on Reddit
Model Setup Help - Data Upload
I am looking to create a model that contains a hierarchy of items (think of Country, State, City, Town, as an example). In the end I want users to be able to select these items from a drop-down while inputting other data to separate models. I'm new to django so please bear with me. In this case, would I just never pass a POST to this model, as users would never be required nor would I want them to add data to this table AND how would I initially get this table populated? From what I have gathered, I would use pgadmin (using postgres in this case) to upload the data from a csv, correct?
​
I have an additional question, related to models, but unrelated to the above. I can post in a new topic if that's preferred. Nevertheless, I'm confused (and I think it's the admin dashboard that is confusing me) with how my form submission will submit data to my database. I understand how it works but how would I go about iterating related fields based on a specific field's submissions? As a functionally similar concept, think of my app as
/r/djangolearning
https://redd.it/aspd3k
I am looking to create a model that contains a hierarchy of items (think of Country, State, City, Town, as an example). In the end I want users to be able to select these items from a drop-down while inputting other data to separate models. I'm new to django so please bear with me. In this case, would I just never pass a POST to this model, as users would never be required nor would I want them to add data to this table AND how would I initially get this table populated? From what I have gathered, I would use pgadmin (using postgres in this case) to upload the data from a csv, correct?
​
I have an additional question, related to models, but unrelated to the above. I can post in a new topic if that's preferred. Nevertheless, I'm confused (and I think it's the admin dashboard that is confusing me) with how my form submission will submit data to my database. I understand how it works but how would I go about iterating related fields based on a specific field's submissions? As a functionally similar concept, think of my app as
/r/djangolearning
https://redd.it/aspd3k
reddit
r/djangolearning - Model Setup Help - Data Upload
1 vote and 1 comment so far on Reddit
Looking for advice on how to structure my app
Hello,
I am working on an application that has a web interface that users can register on but mainly works with sending text messages.
Since I am kind of new to Flask, I am unsure about how to structure this application. I have not yet finished the functionality of the app but this is what my structure looks like right now:
​
project folder
* main
* assets
* core
* \_\_init\_\_.py
* views.py
* messages
* \_\_init\_\_.py
* views.py
* logic
* logic.py
* static
* templates
* users
* \_\_init\_\_.py
* views.py
* \_\_init\_\_.py
* models.py
* [app.py](https://app.py)
​
Within the core folder, I have the views that actually render templates for the website visitor to see. The messages/views.py includes the routes that handle the text messaging.
Now what I am mainly concerned about is my logic folder. I want to set this app up so that every day at a given time,
/r/flask
https://redd.it/at8xb6
Hello,
I am working on an application that has a web interface that users can register on but mainly works with sending text messages.
Since I am kind of new to Flask, I am unsure about how to structure this application. I have not yet finished the functionality of the app but this is what my structure looks like right now:
​
project folder
* main
* assets
* core
* \_\_init\_\_.py
* views.py
* messages
* \_\_init\_\_.py
* views.py
* logic
* logic.py
* static
* templates
* users
* \_\_init\_\_.py
* views.py
* \_\_init\_\_.py
* models.py
* [app.py](https://app.py)
​
Within the core folder, I have the views that actually render templates for the website visitor to see. The messages/views.py includes the routes that handle the text messaging.
Now what I am mainly concerned about is my logic folder. I want to set this app up so that every day at a given time,
/r/flask
https://redd.it/at8xb6
Using other front end frame works with flask
Are there any other front end frame works that I can use with flask. Was using jinja2 which I’ve found to be a little slow. Currently teaching myself how to use vuejs. Returning everything in json now. Could return everything and use jquery to populate html.
Thanks in advance
/r/flask
https://redd.it/ata3vr
Are there any other front end frame works that I can use with flask. Was using jinja2 which I’ve found to be a little slow. Currently teaching myself how to use vuejs. Returning everything in json now. Could return everything and use jquery to populate html.
Thanks in advance
/r/flask
https://redd.it/ata3vr
reddit
r/flask - Using other front end frame works with flask
0 votes and 1 comment so far on Reddit
Design advice needed: Editing models in views
Hello,
I'm somewhat new to Django/front end web development so I'm wondering what the best way to accomplish this would be. I have a "Rule" model which is made up of a few other models. On the view page, I'd like to list all the Rules with their associated attributes. In each Rule, I'd like the user to be able to edit it and adjust the attributes associated with the Rule. Once they click save, I'd like to update the relevant models in the database and reflect that on the page, but I DO NOT want the page to refresh. I know I can do this using a JS library but it seems, from my research, that'd I'd have to create a rather janky and potentially insecure POST request. I could use ModelForms, but I'm unclear how I basically keep the entire page from refreshing rather than just the individual Rule being edited. Any advice on how to accomplish this is GREATLY appreciated. Thanks!
/r/django
https://redd.it/atbh25
Hello,
I'm somewhat new to Django/front end web development so I'm wondering what the best way to accomplish this would be. I have a "Rule" model which is made up of a few other models. On the view page, I'd like to list all the Rules with their associated attributes. In each Rule, I'd like the user to be able to edit it and adjust the attributes associated with the Rule. Once they click save, I'd like to update the relevant models in the database and reflect that on the page, but I DO NOT want the page to refresh. I know I can do this using a JS library but it seems, from my research, that'd I'd have to create a rather janky and potentially insecure POST request. I could use ModelForms, but I'm unclear how I basically keep the entire page from refreshing rather than just the individual Rule being edited. Any advice on how to accomplish this is GREATLY appreciated. Thanks!
/r/django
https://redd.it/atbh25
reddit
r/django - Design advice needed: Editing models in views
0 votes and 2 comments so far on Reddit
What happened to Oriole Online Tutorials on Safari Books? They have stopped doing those
I was swiping through O'reilly's library with tuts - found those some time ago but there is nothing new on Jupyter. Thanks!
/r/JupyterNotebooks
https://redd.it/at8win
I was swiping through O'reilly's library with tuts - found those some time ago but there is nothing new on Jupyter. Thanks!
/r/JupyterNotebooks
https://redd.it/at8win
reddit
r/JupyterNotebooks - What happened to Oriole Online Tutorials on Safari Books? They have stopped doing those
1 vote and 0 comments so far on Reddit
This media is not supported in your browser
VIEW IN TELEGRAM
y’all are so are so advanced with you project but this is my first project in python hope u like it😂
/r/Python
https://redd.it/ataswq
/r/Python
https://redd.it/ataswq
Question about handling authentications with tokens using Django Rest framework
Hello everyone! I am trying to build a mobile application with Django in the backend. For this I am using Django rest framework. Looking at the docs, I am confused about the usage of OAuth or JWT Authentication in my application. I have been using djangorestframework-jwt but this doesn't support obtaining access token after they expire using the refresh token mechanism (Note: It only supports the mechanism to refresh token before it is expired which is a different thing). So I am thinking of going with django-rest-framework-simplejwt. However, this doesn't store the refresh tokens in the database. Are there any drawbacks to it? Can I use it in my application without having to worry about the security provided that both the access-token and refresh-tokens stored in the local storage of the device are encrypted? Or is there anything else, I need to consider before taking this route? And what functionality do the Oauth toolkits provide? As far as I know OAuth is a protocol for authentication which may or may not use JWTs as token formats. Do I need to use them for better functionality whatever they maybe? To keep it simple, I just need to do what the mobile
/r/djangolearning
https://redd.it/asas6t
Hello everyone! I am trying to build a mobile application with Django in the backend. For this I am using Django rest framework. Looking at the docs, I am confused about the usage of OAuth or JWT Authentication in my application. I have been using djangorestframework-jwt but this doesn't support obtaining access token after they expire using the refresh token mechanism (Note: It only supports the mechanism to refresh token before it is expired which is a different thing). So I am thinking of going with django-rest-framework-simplejwt. However, this doesn't store the refresh tokens in the database. Are there any drawbacks to it? Can I use it in my application without having to worry about the security provided that both the access-token and refresh-tokens stored in the local storage of the device are encrypted? Or is there anything else, I need to consider before taking this route? And what functionality do the Oauth toolkits provide? As far as I know OAuth is a protocol for authentication which may or may not use JWTs as token formats. Do I need to use them for better functionality whatever they maybe? To keep it simple, I just need to do what the mobile
/r/djangolearning
https://redd.it/asas6t
reddit
r/djangolearning - Question about handling authentications with tokens using Django Rest framework
6 votes and 1 comment so far on Reddit
Flask-login limit pages to admin accounts
I've implemented Flask-login extension on my site which I am very happy with. I don't want to use Flask-user yet as I want to understand everything before I give over control and become dependant on Flask-user for everything.
I've been using my google-fu for about two days and I can't find a simple way to limit pages for admins in a pythonic/flask type way. My current hack involves something like this:
@admin.route("/admin")
@login_required
def admin_home():
account_type = current_user.account_type
if account_type == "admin":
return render_template("admin/admin.html")
else:
return redirect(url_for("member.member_page"))
Which works and I will turn it into a function if its the best way to do it. BUT I can't believe there isn't a snippit
I've built my own decorator before, would you build a new decorator to between the function and the @login\_required? Or is there some easy way that I haven't found? Nothing
/r/flask
https://redd.it/ath57t
I've implemented Flask-login extension on my site which I am very happy with. I don't want to use Flask-user yet as I want to understand everything before I give over control and become dependant on Flask-user for everything.
I've been using my google-fu for about two days and I can't find a simple way to limit pages for admins in a pythonic/flask type way. My current hack involves something like this:
@admin.route("/admin")
@login_required
def admin_home():
account_type = current_user.account_type
if account_type == "admin":
return render_template("admin/admin.html")
else:
return redirect(url_for("member.member_page"))
Which works and I will turn it into a function if its the best way to do it. BUT I can't believe there isn't a snippit
I've built my own decorator before, would you build a new decorator to between the function and the @login\_required? Or is there some easy way that I haven't found? Nothing
/r/flask
https://redd.it/ath57t
reddit
r/flask - Flask-login limit pages to admin accounts
3 votes and 3 comments so far on Reddit
sessions persisting across requests
Hi all, I'm running flask with gunicorn and having issues with the session persisting across requests.
the session persists when going from /set to /check. But when a session value is set in the authenticate route
it is then lost, no idea why this is happening and a bit lost now.
# //-- api route app.py
from flask import Flask, session
from flask_session import Session
import routes.authenticate
import redis
Authenticate = routes.authenticate.Authenticate()
app = Flask(__name__)
app.config['SESSION_TYPE'] = 'redis'
app.SESSION_REDIS = redis.Redis("redis")
app.secret_key = "123"
sess = Session()
sess.init_app(app)
@app.route("/set", methods=["GET"])
def set():
session["test] = "foo"
print(session)
/r/flask
https://redd.it/at1cwy
Hi all, I'm running flask with gunicorn and having issues with the session persisting across requests.
the session persists when going from /set to /check. But when a session value is set in the authenticate route
it is then lost, no idea why this is happening and a bit lost now.
# //-- api route app.py
from flask import Flask, session
from flask_session import Session
import routes.authenticate
import redis
Authenticate = routes.authenticate.Authenticate()
app = Flask(__name__)
app.config['SESSION_TYPE'] = 'redis'
app.SESSION_REDIS = redis.Redis("redis")
app.secret_key = "123"
sess = Session()
sess.init_app(app)
@app.route("/set", methods=["GET"])
def set():
session["test] = "foo"
print(session)
/r/flask
https://redd.it/at1cwy
reddit
r/flask - sessions persisting across requests
1 vote and 4 comments so far on Reddit
Serialchemy: a library to serialize/deserialize SQLAlchemy models
https://github.com/esss/serialchemy
_Serialchemy was developed as a module of a lib to create Restful APIs using Flask and SQLAlchemy. We first tried marshmallow-sqlalchemy, probably the most well-known lib for SQLAlchemy model serialization, but we faced issues related to nested models. We also think that is possible to build a simpler and more maintainable solution by having SQLAlchemy in mind from the ground up, as opposed to marshmallow-sqlalchemy that had to be designed and built on top of marshmallow._
Suggestions and reviews are extremely welcome.
/r/flask
https://redd.it/atom47
https://github.com/esss/serialchemy
_Serialchemy was developed as a module of a lib to create Restful APIs using Flask and SQLAlchemy. We first tried marshmallow-sqlalchemy, probably the most well-known lib for SQLAlchemy model serialization, but we faced issues related to nested models. We also think that is possible to build a simpler and more maintainable solution by having SQLAlchemy in mind from the ground up, as opposed to marshmallow-sqlalchemy that had to be designed and built on top of marshmallow._
Suggestions and reviews are extremely welcome.
/r/flask
https://redd.it/atom47
GitHub
ESSS/serialchemy
Contribute to ESSS/serialchemy development by creating an account on GitHub.
Does someone has ever heard about odata and graphql?
Hi all,
currently I am reading a little about graphql, it sounds like a nice idea to make the data transaction a little faster, only add several line codes. Then I remebered another language, odata, an open data protocol, which is heavily used by SAP. Then I did a little search in google, it looks like odata is more powerful than graphql. So, I want ask you guys here, did you ever heard about the two things? Have you ever used it? What's your opinions?
​
​
/r/flask
https://redd.it/asb59s
Hi all,
currently I am reading a little about graphql, it sounds like a nice idea to make the data transaction a little faster, only add several line codes. Then I remebered another language, odata, an open data protocol, which is heavily used by SAP. Then I did a little search in google, it looks like odata is more powerful than graphql. So, I want ask you guys here, did you ever heard about the two things? Have you ever used it? What's your opinions?
​
​
/r/flask
https://redd.it/asb59s
reddit
r/flask - Does someone has ever heard about odata and graphql?
3 votes and 2 comments so far on Reddit