Best practice for for creating a user based token for 3rd party apps in Django?
I have an application that needs users to give access to a 3rd party application.
The requirements are that the 3rd party application has the same permissions as the user (acts on the user's behalf)
The 3rd party application has no frontend, so the oauth2 redirection flow doesn't quite work.
My initial thought was to create a model for 3rd-party applications and the User can add their own apps.
By adding an app, the user would receive a app ID (or client id) and a app Secret (or client secret). The user gives the 3rd party app this information and it can request a Bearer Token once (After that, this combination of ID and Secret won't work). That Bearer Token will live for X seconds, but the application can refresh the Token with a Refresh Token it will get back as well.
I realize this looks almost identical to Oauth2, but I haven't figured out how to achieve it with Django Oauth Toolkit at least.
Any recommendations?
Thanks!
/r/django
https://redd.it/gsef2g
I have an application that needs users to give access to a 3rd party application.
The requirements are that the 3rd party application has the same permissions as the user (acts on the user's behalf)
The 3rd party application has no frontend, so the oauth2 redirection flow doesn't quite work.
My initial thought was to create a model for 3rd-party applications and the User can add their own apps.
By adding an app, the user would receive a app ID (or client id) and a app Secret (or client secret). The user gives the 3rd party app this information and it can request a Bearer Token once (After that, this combination of ID and Secret won't work). That Bearer Token will live for X seconds, but the application can refresh the Token with a Refresh Token it will get back as well.
I realize this looks almost identical to Oauth2, but I haven't figured out how to achieve it with Django Oauth Toolkit at least.
Any recommendations?
Thanks!
/r/django
https://redd.it/gsef2g
reddit
Best practice for for creating a user based token for 3rd party...
I have an application that needs users to give access to a 3rd party application. The requirements are that the 3rd party application has the...
This media is not supported in your browser
VIEW IN TELEGRAM
Working on a text-based "choose your adventure" story-telling game played in the terminal!
/r/Python
https://redd.it/gseyw9
/r/Python
https://redd.it/gseyw9
Flask+MySQL. App reloads the same page instead of routing and it fails to add values to mysql db
https://stackoverflow.com/questions/62075278/flaskmysql-app-reloads-the-same-page-instead-of-routing-and-it-fails-to-add-va
/r/flask
https://redd.it/gsg5px
https://stackoverflow.com/questions/62075278/flaskmysql-app-reloads-the-same-page-instead-of-routing-and-it-fails-to-add-va
/r/flask
https://redd.it/gsg5px
Stack Overflow
Flask+MySQL. App reloads the same page instead of routing and it fails to add values to mysql db
I know there is much of code below, but i had to show the html/css/js and flask+mysql codes for better understanding. Ask if anything is not clear.
The problem is that, after i give the credential...
The problem is that, after i give the credential...
High Performance Python: Second Edition
https://ianozsvald.com/2020/05/20/weekish-note/
/r/Python
https://redd.it/gso57z
https://ianozsvald.com/2020/05/20/weekish-note/
/r/Python
https://redd.it/gso57z
Entrepreneurial Geekiness
Week(ish) note
So - High Performance Python 2nd ed finally shipped (Amazon, Goodreads) - yay! In brief we've added notes on how you can be a "highly performant programmer", added some more profiling, added Pandas onto NumPy, improved the Compiling to C chapter with more…
im a loner, so i wrote a program to write my diaries / express my feelings to my future self
https://www.youtube.com/watch?v=XUcAll7VcsY
/r/Python
https://redd.it/gsmz82
https://www.youtube.com/watch?v=XUcAll7VcsY
/r/Python
https://redd.it/gsmz82
[META] I think this subreddit should also have a help me flair, or a question flair ?
/r/django
https://redd.it/gso6us
/r/django
https://redd.it/gso6us
reddit
[META] I think this subreddit should also have a help me flair, or...
Posted in r/django by u/amana_araragi • 28 points and 3 comments
Is it possible to have more than one of a single form on a single page?
I’ve been working on this flask app that when you’ve logged in as a teacher it displays all of your students in a single neat table. The final entry of each table row I’ve made into a delete button that works of a form that has two fields: userid and submit. I’ve set the values for all the userid parts of the forms to be the right values and I’ve hidden those with some formatting. But for whatever reason whenever I click the delete, the form is not validated in my routes page. I can provide code if necessary. Is the problem that I have two of the same form in the same page or have I made an error somewhere else?
/r/flask
https://redd.it/gsrwsy
I’ve been working on this flask app that when you’ve logged in as a teacher it displays all of your students in a single neat table. The final entry of each table row I’ve made into a delete button that works of a form that has two fields: userid and submit. I’ve set the values for all the userid parts of the forms to be the right values and I’ve hidden those with some formatting. But for whatever reason whenever I click the delete, the form is not validated in my routes page. I can provide code if necessary. Is the problem that I have two of the same form in the same page or have I made an error somewhere else?
/r/flask
https://redd.it/gsrwsy
reddit
Is it possible to have more than one of a single form on a single...
I’ve been working on this flask app that when you’ve logged in as a teacher it displays all of your students in a single neat table. The final...
Ecommerce cart for nonregistered users
I'm building an ecommerce site with flask and mysql. I want to know how to implement a cart for non registered users.
For registered users I want their cart to be stored in the database. But I do not know how to make a cart for non registered users
/r/flask
https://redd.it/gsql8z
I'm building an ecommerce site with flask and mysql. I want to know how to implement a cart for non registered users.
For registered users I want their cart to be stored in the database. But I do not know how to make a cart for non registered users
/r/flask
https://redd.it/gsql8z
reddit
Ecommerce cart for nonregistered users
I'm building an ecommerce site with flask and mysql. I want to know how to implement a cart for non registered users. For registered users I want...
Form Submission with AJAX to SQLite Database - Tutorial
After struggling with Ajax using vanilla JavaScript I decided to upload a YouTube tutorial so it can be an easy reference for those learning Ajax requests in Vanilla JavaScript with Flask as back-end. Here is a link to YouTube tutorial video created and uploaded by me.
​
[https://youtu.be/lUTpjsgcXMQ](https://youtu.be/lUTpjsgcXMQ)
/r/flask
https://redd.it/gsx944
After struggling with Ajax using vanilla JavaScript I decided to upload a YouTube tutorial so it can be an easy reference for those learning Ajax requests in Vanilla JavaScript with Flask as back-end. Here is a link to YouTube tutorial video created and uploaded by me.
​
[https://youtu.be/lUTpjsgcXMQ](https://youtu.be/lUTpjsgcXMQ)
/r/flask
https://redd.it/gsx944
YouTube
Form Submission with AJAX to SQLite Database; Flask Back-end; Vanilla JavaScript for Ajax
In this video I will teach you how to submit a form data to a SQLite database with Flask back-end and Vanilla JavaScript ajax request so that form submission happens asynchronously i.e. without reloading the page.
[Note: I am using robot reader so there…
[Note: I am using robot reader so there…
Django Channels and React: a match made in heaven
https://www.fullstackdjango.com/post/django-channels-and-react-a-match-made-in-heaven
/r/django
https://redd.it/gstqoy
https://www.fullstackdjango.com/post/django-channels-and-react-a-match-made-in-heaven
/r/django
https://redd.it/gstqoy
Fullstackdjango
Django Channels and React: a match made in heaven
Fullstack Django teaches you how to build good-looking web applications with Django and modern frontend technologies
snakeware - a new Linux Distro with a fully Python userspace
snakeware is a new Linux-based operating system with a fully Python userspace. Our window manager is based on pygame\_gui. We do not use X11, we draw directly to the framebuffer. We also do not use systemd or any of the other huge and typical GNU/Linux utilities, because they are very opaque and not fun for recreational programmers to contribute to.
Our distro boots directly into a Python environment, where you can then do whatever you want with your computer. It's being designed based on the spirit of the Commodore 64, which is primarily that computing should be simple and fun. snakeware is still early in development, but we would like to welcome more contributors as the project grows (both in the Python space and in the build/packaging process for the actual distro).
snakeware GitHub: [https://github.com/joshiemoore/snakeware](https://github.com/joshiemoore/snakeware)
YouTube Demo: [https://www.youtube.com/watch?v=Zy8NXuzBPhA](https://www.youtube.com/watch?v=Zy8NXuzBPhA)
Thanks for reading, I'd love to hear what you think!
edit - added a screenshot
https://preview.redd.it/bxqsh4lkop151.png?width=801&format=png&auto=webp&s=b31455342250cd6f7d7f071370498d57cec1f728
/r/Python
https://redd.it/gstn6b
snakeware is a new Linux-based operating system with a fully Python userspace. Our window manager is based on pygame\_gui. We do not use X11, we draw directly to the framebuffer. We also do not use systemd or any of the other huge and typical GNU/Linux utilities, because they are very opaque and not fun for recreational programmers to contribute to.
Our distro boots directly into a Python environment, where you can then do whatever you want with your computer. It's being designed based on the spirit of the Commodore 64, which is primarily that computing should be simple and fun. snakeware is still early in development, but we would like to welcome more contributors as the project grows (both in the Python space and in the build/packaging process for the actual distro).
snakeware GitHub: [https://github.com/joshiemoore/snakeware](https://github.com/joshiemoore/snakeware)
YouTube Demo: [https://www.youtube.com/watch?v=Zy8NXuzBPhA](https://www.youtube.com/watch?v=Zy8NXuzBPhA)
Thanks for reading, I'd love to hear what you think!
edit - added a screenshot
https://preview.redd.it/bxqsh4lkop151.png?width=801&format=png&auto=webp&s=b31455342250cd6f7d7f071370498d57cec1f728
/r/Python
https://redd.it/gstn6b
GitHub
GitHub - joshiemoore/snakeware: A free Linux distro with a Python-based userspace
A free Linux distro with a Python-based userspace. Contribute to joshiemoore/snakeware development by creating an account on GitHub.
Stripe with Django - are you using just stripe or dj-stripe?
I'm curious about what experienced devs are using for implementing Stripe with Django.
I see there is dj-stripe [https://github.com/dj-stripe/dj-stripe](https://github.com/dj-stripe/dj-stripe)
​
But also stripe has their own, and looks fairly simple, install method: [https://stripe.com/docs/payments/accept-a-payment-charges#web](https://stripe.com/docs/payments/accept-a-payment-charges#web)
​
In this tutorial [https://testdriven.io/blog/django-stripe-tutorial/](https://testdriven.io/blog/django-stripe-tutorial/) they don't use anything to set it up.
​
Ultimately, I will be using Stripe Connect. The flow I will be doing is:
1. authorize payment
2. capture payment (1-7 days later)
Not subscriptions or anything like that.
​
What are your inputs. Is using dj-stripe worth it for what I need or?
/r/django
https://redd.it/gt21py
I'm curious about what experienced devs are using for implementing Stripe with Django.
I see there is dj-stripe [https://github.com/dj-stripe/dj-stripe](https://github.com/dj-stripe/dj-stripe)
​
But also stripe has their own, and looks fairly simple, install method: [https://stripe.com/docs/payments/accept-a-payment-charges#web](https://stripe.com/docs/payments/accept-a-payment-charges#web)
​
In this tutorial [https://testdriven.io/blog/django-stripe-tutorial/](https://testdriven.io/blog/django-stripe-tutorial/) they don't use anything to set it up.
​
Ultimately, I will be using Stripe Connect. The flow I will be doing is:
1. authorize payment
2. capture payment (1-7 days later)
Not subscriptions or anything like that.
​
What are your inputs. Is using dj-stripe worth it for what I need or?
/r/django
https://redd.it/gt21py
GitHub
GitHub - dj-stripe/dj-stripe: dj-stripe automatically syncs your Stripe Data to your local database as pre-implemented Django Models…
dj-stripe automatically syncs your Stripe Data to your local database as pre-implemented Django Models allowing you to use the Django ORM, in your code, to work with the data making it easier and f...
[P] Star Clustering: A clustering algorithm that automatically determines the number of clusters and doesn't require hyperparameter tuning.
[https://github.com/josephius/star-clustering](https://github.com/josephius/star-clustering)
So, this has been a thing I've been working on a for a while now in my spare time. I realized at work that some of my colleagues were complaining about clustering algorithms being finicky, so I took it upon myself to see if I could somehow come up with something that could handle the issues that were apparent with traditional clustering algorithms. However, as my background was more computer science than statistics, I approached this as an engineering problem rather than trying to ground it in a clear mathematical theory.
The result is what I'm tentatively calling Star Clustering, because the algorithm vaguely resembles and the analogy of star system formation, where particles close to each other clump together (join together the shortest distances first) and some of the clumps are massive enough to reach critical mass and ignite fusion (become the final clusters), while others end up orbiting them (joining the nearest cluster). It's not an exact analogy, but it's the closest I can think of to what the algorithm more or less does.
So, after a lot of trial and error, I got an implementation that seems to work really well on the data I
/r/MachineLearning
https://redd.it/gsu3zm
[https://github.com/josephius/star-clustering](https://github.com/josephius/star-clustering)
So, this has been a thing I've been working on a for a while now in my spare time. I realized at work that some of my colleagues were complaining about clustering algorithms being finicky, so I took it upon myself to see if I could somehow come up with something that could handle the issues that were apparent with traditional clustering algorithms. However, as my background was more computer science than statistics, I approached this as an engineering problem rather than trying to ground it in a clear mathematical theory.
The result is what I'm tentatively calling Star Clustering, because the algorithm vaguely resembles and the analogy of star system formation, where particles close to each other clump together (join together the shortest distances first) and some of the clumps are massive enough to reach critical mass and ignite fusion (become the final clusters), while others end up orbiting them (joining the nearest cluster). It's not an exact analogy, but it's the closest I can think of to what the algorithm more or less does.
So, after a lot of trial and error, I got an implementation that seems to work really well on the data I
/r/MachineLearning
https://redd.it/gsu3zm
GitHub
GitHub - josephius/star-clustering: A clustering algorithm that automatically determines the number of clusters and works without…
A clustering algorithm that automatically determines the number of clusters and works without hyperparameter fine-tuning. - josephius/star-clustering
Fetch API works locally not when deployed to Azure cloud.
I think I need to add some value somewhere but I don't know where.
/r/flask
https://redd.it/gt673s
I think I need to add some value somewhere but I don't know where.
/r/flask
https://redd.it/gt673s
reddit
Fetch API works locally not when deployed to Azure cloud.
I think I need to add some value somewhere but I don't know where.
Fetch API works locally not when deployed to Azure cloud
**Error Fixed- Disregard**
​
I have a index.html and a python flask server.
The goal of this setup is to paste a long URL in a text box and when a button is pressed the long URL should be sent to the flask app via fetch API and the flask app responds with a shorter URL.
Here is the link → [https://uatomeletxyz.azurewebsites.net/](https://uatomeletxyz.azurewebsites.net/)
This works perfectly in local but when I deploy on Azure console shows the following error.
[https://uatomeletxyz.azurewebsites.net/favicon.ico](https://uatomeletxyz.azurewebsites.net/favicon.ico) 500 (INTERNAL SERVER ERROR)
VM62:1 POST [https://uatomeletxyz.azurewebsites.net/](https://uatomeletxyz.azurewebsites.net/) 500 (INTERNAL SERVER ERROR)
[uatomeletxyz.azurewebsites.net/:1](https://uatomeletxyz.azurewebsites.net/:1) Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
/r/flask
https://redd.it/gt6se4
**Error Fixed- Disregard**
​
I have a index.html and a python flask server.
The goal of this setup is to paste a long URL in a text box and when a button is pressed the long URL should be sent to the flask app via fetch API and the flask app responds with a shorter URL.
Here is the link → [https://uatomeletxyz.azurewebsites.net/](https://uatomeletxyz.azurewebsites.net/)
This works perfectly in local but when I deploy on Azure console shows the following error.
[https://uatomeletxyz.azurewebsites.net/favicon.ico](https://uatomeletxyz.azurewebsites.net/favicon.ico) 500 (INTERNAL SERVER ERROR)
VM62:1 POST [https://uatomeletxyz.azurewebsites.net/](https://uatomeletxyz.azurewebsites.net/) 500 (INTERNAL SERVER ERROR)
[uatomeletxyz.azurewebsites.net/:1](https://uatomeletxyz.azurewebsites.net/:1) Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
/r/flask
https://redd.it/gt6se4
QQ - global-scope variable in views.py?
Long story short, I've got a list of <whatever> I want to randomize and pass in to my template in a few different views.
I obviously don't want to repeat this list in every view. I understand that in this scope if I'm calling \`list.shuffle()\` and throwing it into templates, I'm playing with fire. I know that should be fine, but its probably a bad practice.
I thought of making it a "constant", and then just making sure I do a deep copy before calling shuffle on it and passing it to the templates, but I'm not sure that's ideal either.
What's the cleanest way to do this? The context data is style/css related, so I don't want it with the model.
/r/django
https://redd.it/gt8s7d
Long story short, I've got a list of <whatever> I want to randomize and pass in to my template in a few different views.
I obviously don't want to repeat this list in every view. I understand that in this scope if I'm calling \`list.shuffle()\` and throwing it into templates, I'm playing with fire. I know that should be fine, but its probably a bad practice.
I thought of making it a "constant", and then just making sure I do a deep copy before calling shuffle on it and passing it to the templates, but I'm not sure that's ideal either.
What's the cleanest way to do this? The context data is style/css related, so I don't want it with the model.
/r/django
https://redd.it/gt8s7d
reddit
QQ - global-scope variable in views.py?
Long story short, I've got a list of I want to randomize and pass in to my template in a few different views. I obviously don't want...
This media is not supported in your browser
VIEW IN TELEGRAM
To everyone who is learning python right now, with enough practice you too can create a masterpiece like this.
/r/Python
https://redd.it/gsxzjq
/r/Python
https://redd.it/gsxzjq
This media is not supported in your browser
VIEW IN TELEGRAM
[R] AutoSweep: Recovering 3D Editable Objects from a Single Photograph
/r/MachineLearning
https://redd.it/gtaq94
/r/MachineLearning
https://redd.it/gtaq94