Session data lost after redirect but only with iPad
My Django app integrates with GoCardless, a UK payment provider through their API. When a user sets up a new GoCardless account the process works as follows:
* My app generates a token and saves it in a session variable
* It redirects to GoCardless which captures the user's account data via 2 screens.
* GoCardless redirects back to my app
* My app retrieves the token from the session and call their API to complete the process.
This has been working fine for over 2 years and still works fine with Chrome, Edge or Firefox. But recently I started getting error reports from users. Investigation shows these are users with an iPad or iPhone, and what is happening is that all Django's session information has been lost by the time GoCardless redirects back to me.
My guess is that this behaviour is associated with some recently added measures in ios to avoid tracking by cookies and the session data is lost as soon as the user leaves the site.
Does anyone know exactly why this is happening? Can anything be done in the Django settings to avoid it?
I have sidestepped the issue for now by saving the token in a database table instead of in
/r/django
https://redd.it/b9qp5a
My Django app integrates with GoCardless, a UK payment provider through their API. When a user sets up a new GoCardless account the process works as follows:
* My app generates a token and saves it in a session variable
* It redirects to GoCardless which captures the user's account data via 2 screens.
* GoCardless redirects back to my app
* My app retrieves the token from the session and call their API to complete the process.
This has been working fine for over 2 years and still works fine with Chrome, Edge or Firefox. But recently I started getting error reports from users. Investigation shows these are users with an iPad or iPhone, and what is happening is that all Django's session information has been lost by the time GoCardless redirects back to me.
My guess is that this behaviour is associated with some recently added measures in ios to avoid tracking by cookies and the session data is lost as soon as the user leaves the site.
Does anyone know exactly why this is happening? Can anything be done in the Django settings to avoid it?
I have sidestepped the issue for now by saving the token in a database table instead of in
/r/django
https://redd.it/b9qp5a
reddit
r/django - Session data lost after redirect but only with iPad
5 votes and 3 comments so far on Reddit
Django with Saleor in NYC
Is anyone else in NYC using/planning to use Django with Saleor? If so, I'd love to plan a meetup and compare notes/projects! Please let me know.
​
Thank you!
​
Jeff
/r/django
https://redd.it/b9t7bg
Is anyone else in NYC using/planning to use Django with Saleor? If so, I'd love to plan a meetup and compare notes/projects! Please let me know.
​
Thank you!
​
Jeff
/r/django
https://redd.it/b9t7bg
reddit
r/django - Django with Saleor in NYC
0 votes and 0 comments so far on Reddit
Beginner question
FYI I have no previous experience in coding. Here goes my question:
My mac has both pythons installed. I want to code in sublime text. Now to the best of my knowledge I have to find a path to python3 yo set it as a default for sublime. When I run $ test -a python3 it gives me 2 paths. One is simple another one is little larger. Both of them say python3 at the end. However when I connect it to sublime terminal box in sublime still says python2.
I'm not sure if I explained it well. Hope it's clear. Has anyone experienced the same problem?
/r/Python
https://redd.it/b9szos
FYI I have no previous experience in coding. Here goes my question:
My mac has both pythons installed. I want to code in sublime text. Now to the best of my knowledge I have to find a path to python3 yo set it as a default for sublime. When I run $ test -a python3 it gives me 2 paths. One is simple another one is little larger. Both of them say python3 at the end. However when I connect it to sublime terminal box in sublime still says python2.
I'm not sure if I explained it well. Hope it's clear. Has anyone experienced the same problem?
/r/Python
https://redd.it/b9szos
reddit
r/Python - Beginner question
3 votes and 4 comments so far on Reddit
[Help]simple betting game that keep running track of money.
This is a very simple game im doing just for sake of learning. Ive done all this from memory and debugging. I have been stumped at the running total. Like if I win 500 I want the game to remember im at 5500 and if I win 500 again I would be at 6000 but the game just sees that 5000 stored in money at the beginning of the def and no matter how much I win its gone after every game. If anyone could help, it would be greatly appreciated!
import random
def gamble():
x = int(input('choose 1 or 2: '))
money = int(5000)
print('you have: ', money)
bet = int(input('How much would you like to bet?, you have: '))
y = int(random.randint(1,2))
if x == y:
/r/Python
https://redd.it/b9w49e
This is a very simple game im doing just for sake of learning. Ive done all this from memory and debugging. I have been stumped at the running total. Like if I win 500 I want the game to remember im at 5500 and if I win 500 again I would be at 6000 but the game just sees that 5000 stored in money at the beginning of the def and no matter how much I win its gone after every game. If anyone could help, it would be greatly appreciated!
import random
def gamble():
x = int(input('choose 1 or 2: '))
money = int(5000)
print('you have: ', money)
bet = int(input('How much would you like to bet?, you have: '))
y = int(random.randint(1,2))
if x == y:
/r/Python
https://redd.it/b9w49e
reddit
r/Python - [Help]simple betting game that keep running track of money.
0 votes and 2 comments so far on Reddit
[P] I'm a bot and will serve people analyzing chess positions from images posted on /r/chess
A few days ago, my creator, u/pkacprzak, wrote a [post](https://www.reddit.com/r/MachineLearning/comments/b8jdho/p_detect_and_analyze_chess_positions_with_ai_from/) about [chessvision.ai](https://chessvision.ai/) \- his computer vision/machine learning app to analyze chess positions from any website and video in a browser.
​
Since then, people reached him suggesting that it'd be nice to build a bot for [r/chess](https://www.reddit.com/r/chess) that can work with the app, analyze chess images posted there and provide automatic position analysis.
​
All of us love the awesome [u/ChessFenBot](https://www.reddit.com/u/ChessFenBot) that was doing just that, but for some reason, it hasn't been working recently,
​
so from now I, [u/chessvision-ai-bot](https://www.reddit.com/u/chessvision-ai-bot), will be pleased to serve you!
​
I'm trying to analyze pictures posted on r/chess, both as links as well as content images, and if a picture contains a chess position, I'm gonna provide analysis and editor boards links for you. The image doesn't have to be perfect, I'll try my best to find the chessboard if it's there and identify the position.
​
Please give me some love, yeah I mean upvotes, because as a new user I'm limited in performing requests to reddit API and I really want to serve you well!
/r/MachineLearning
https://redd.it/b9prd1
A few days ago, my creator, u/pkacprzak, wrote a [post](https://www.reddit.com/r/MachineLearning/comments/b8jdho/p_detect_and_analyze_chess_positions_with_ai_from/) about [chessvision.ai](https://chessvision.ai/) \- his computer vision/machine learning app to analyze chess positions from any website and video in a browser.
​
Since then, people reached him suggesting that it'd be nice to build a bot for [r/chess](https://www.reddit.com/r/chess) that can work with the app, analyze chess images posted there and provide automatic position analysis.
​
All of us love the awesome [u/ChessFenBot](https://www.reddit.com/u/ChessFenBot) that was doing just that, but for some reason, it hasn't been working recently,
​
so from now I, [u/chessvision-ai-bot](https://www.reddit.com/u/chessvision-ai-bot), will be pleased to serve you!
​
I'm trying to analyze pictures posted on r/chess, both as links as well as content images, and if a picture contains a chess position, I'm gonna provide analysis and editor boards links for you. The image doesn't have to be perfect, I'll try my best to find the chessboard if it's there and identify the position.
​
Please give me some love, yeah I mean upvotes, because as a new user I'm limited in performing requests to reddit API and I really want to serve you well!
/r/MachineLearning
https://redd.it/b9prd1
Reddit
From the MachineLearning community on Reddit: [P] Detect and Analyze Chess positions with AI from any website/video in a web browser
Explore this post and more from the MachineLearning community
Using python to map the traffic that came to my server after my post hit the front page.
/r/Python
https://redd.it/b9xcit
/r/Python
https://redd.it/b9xcit
SQLAlchemy has no 'Column' member ( or any else )
I installed SQLAlchemy, but keep getting these kind of errors. The whole thing works when I run it, but the linting still gives me errors.
I am using VSCode and the solution given on other sites is to use pylint-flask and add it to settings.json. This does nothing other than point out my pep8 mistakes.
Are there any other solutions?
/r/flask
https://redd.it/b9o3d1
I installed SQLAlchemy, but keep getting these kind of errors. The whole thing works when I run it, but the linting still gives me errors.
I am using VSCode and the solution given on other sites is to use pylint-flask and add it to settings.json. This does nothing other than point out my pep8 mistakes.
Are there any other solutions?
/r/flask
https://redd.it/b9o3d1
reddit
r/flask - SQLAlchemy has no 'Column' member ( or any else )
6 votes and 4 comments so far on Reddit
A project I built to train on python: a twitter bot that tells you if a user is generally negative or not.
Hey everyone!
So after learning the basics of python with automating the boring stuff, I knew if I wanted to go further I had to come up with some ideas and just try to program them. I did a few, from a monitor that tells me when my bus is coming, to a camera remote...
I'm also on Twitter quite a lot, and I like the site. HOWEVER, I noticed a lot of people becoming more and more negative, and sometimes I try to clean my timeline just to stay in a decent mood. I used to unfollow people when one tweet from them annoyed me but I felt sometimes I was being unfair and I lost some good content.
So, I decided to write this bot: for each tagged user, it analyses most of their tweets and gives them a "positivity score" and a percentage of good/bad tweets. It was very useful and nowadays my timeline is much calmer, while still following some really interesting people.
So I put the bot online, it's [https://twitter.com/_PositivityBot] (https://twitter.com/_PositivityBot) and you use it by sending it a message following this pattern : !Analyze username
For example: !Analyze USATODAY or !Analyze @USATODAY
It processes the tweets and then you
/r/Python
https://redd.it/b9yqxd
Hey everyone!
So after learning the basics of python with automating the boring stuff, I knew if I wanted to go further I had to come up with some ideas and just try to program them. I did a few, from a monitor that tells me when my bus is coming, to a camera remote...
I'm also on Twitter quite a lot, and I like the site. HOWEVER, I noticed a lot of people becoming more and more negative, and sometimes I try to clean my timeline just to stay in a decent mood. I used to unfollow people when one tweet from them annoyed me but I felt sometimes I was being unfair and I lost some good content.
So, I decided to write this bot: for each tagged user, it analyses most of their tweets and gives them a "positivity score" and a percentage of good/bad tweets. It was very useful and nowadays my timeline is much calmer, while still following some really interesting people.
So I put the bot online, it's [https://twitter.com/_PositivityBot] (https://twitter.com/_PositivityBot) and you use it by sending it a message following this pattern : !Analyze username
For example: !Analyze USATODAY or !Analyze @USATODAY
It processes the tweets and then you
/r/Python
https://redd.it/b9yqxd
Twitter
Positivity Bot (@_PositivityBot) | Twitter
The latest Tweets from Positivity Bot (@_PositivityBot). Friendly bot, beep boop. I analyse people's timelines to see if they tweet positive things. I work in English and French! Use !Analyze username. At the end of the rainbow!
[P] Thinking of building something like Spotify/a social media site for reading papers--"your friends are reading this, maybe you'd like this paper too". Any suggestions or thoughts?
Inspired by how well Spotify does its recommendations (e.g. Daily Mix).
​
Are there already platforms like this? Close ones that come to mind are Arxiv Sanity, Google Scholar, and Papers With Code. Medium's recommendations/notifications are also pretty good, although they'd have to be written on Medium itself.
​
Any suggestions for implementation, as well as useful features? Right off the bat, I'm thinking along the lines of clustering and/or collaborative filtering.
/r/MachineLearning
https://redd.it/b9tbne
Inspired by how well Spotify does its recommendations (e.g. Daily Mix).
​
Are there already platforms like this? Close ones that come to mind are Arxiv Sanity, Google Scholar, and Papers With Code. Medium's recommendations/notifications are also pretty good, although they'd have to be written on Medium itself.
​
Any suggestions for implementation, as well as useful features? Right off the bat, I'm thinking along the lines of clustering and/or collaborative filtering.
/r/MachineLearning
https://redd.it/b9tbne
reddit
r/MachineLearning - [P] Thinking of building something like Spotify/a social media site for reading papers--"your friends are reading…
110 votes and 28 comments so far on Reddit
New to backend. Wanting to Build Two-sided Online MarketPlace. Flask or Django?
Hello Everyone,
A little background, I am a front-end developer(React) but my long term goal was always to go full stack as i would like to build online businesses (mostly two-sided platforms) using React on the frontend and Python on the backend.
I have been learning Python for the past two weeks and now looking to finally get into either Django or Flask. From the research that i have done, it seems that Django would be the "safer" route as it abstracts a lot and reinforces good backend practices. However, i heard it can be very rigid when it comes to flexibility and even bloated.
On the other hand, i have heard that Flask is very light weight, flexible, and to the point. However, that it can lead to bad practices or even unsafe code if you're not an experienced python developer.
Just need some guidance. What would your advice be?
TL:DR front-end web developer wanting to go full-stack to build online businesses. Heard Django safer and more robust for beginners but rigid and bloated. Heard Flask lightweight and flexible but more prone to beginner's writing bad or unsafe code. Advice?
/r/Python
https://redd.it/ba0ttd
Hello Everyone,
A little background, I am a front-end developer(React) but my long term goal was always to go full stack as i would like to build online businesses (mostly two-sided platforms) using React on the frontend and Python on the backend.
I have been learning Python for the past two weeks and now looking to finally get into either Django or Flask. From the research that i have done, it seems that Django would be the "safer" route as it abstracts a lot and reinforces good backend practices. However, i heard it can be very rigid when it comes to flexibility and even bloated.
On the other hand, i have heard that Flask is very light weight, flexible, and to the point. However, that it can lead to bad practices or even unsafe code if you're not an experienced python developer.
Just need some guidance. What would your advice be?
TL:DR front-end web developer wanting to go full-stack to build online businesses. Heard Django safer and more robust for beginners but rigid and bloated. Heard Flask lightweight and flexible but more prone to beginner's writing bad or unsafe code. Advice?
/r/Python
https://redd.it/ba0ttd
reddit
r/Python - New to backend. Wanting to Build Two-sided Online MarketPlace. Flask or Django?
0 votes and 3 comments so far on Reddit
New to backend. Wanting to Build Two-sided Online MarketPlace. Flask or Django?
Hello everyone,
A little background, I am a front-end developer(React) but my long term goal was always to go full stack as i would like to create and build online businesses (mostly two-sided platforms) using React on the frontend and Python on the backend.
I have been learning Python for the past two weeks and now looking to finally get into either Django or Flask. From the research that i have done, it seems that Django would be the "safer" route as it abstracts a lot and reinforces good backend practices. However, i heard it can be very rigid when it comes to flexibility and even bloated.
On the other hand, i have heard that Flask is very light weight, flexible, and to the point. However, that it can lead to bad practices or even unsafe code if you're not an experienced python developer.
What would be your advice?
TL:DR front-end web developer wanting to go full-stack to build online businesses. Heard Django safer and more robust for beginners but rigid and bloated. Heard Flask lightweight and flexible but more prone to beginner's writing bad or unsafe code. Advice?
/r/django
https://redd.it/ba0nz6
Hello everyone,
A little background, I am a front-end developer(React) but my long term goal was always to go full stack as i would like to create and build online businesses (mostly two-sided platforms) using React on the frontend and Python on the backend.
I have been learning Python for the past two weeks and now looking to finally get into either Django or Flask. From the research that i have done, it seems that Django would be the "safer" route as it abstracts a lot and reinforces good backend practices. However, i heard it can be very rigid when it comes to flexibility and even bloated.
On the other hand, i have heard that Flask is very light weight, flexible, and to the point. However, that it can lead to bad practices or even unsafe code if you're not an experienced python developer.
What would be your advice?
TL:DR front-end web developer wanting to go full-stack to build online businesses. Heard Django safer and more robust for beginners but rigid and bloated. Heard Flask lightweight and flexible but more prone to beginner's writing bad or unsafe code. Advice?
/r/django
https://redd.it/ba0nz6
reddit
r/django - New to backend. Wanting to Build Two-sided Online MarketPlace. Flask or Django?
6 votes and 6 comments so far on Reddit
Python Behind the Hood: The Dictionary
If you ever wondered how Python handles some of its data structures :)
​
[https://medium.freecodecamp.org/exploring-python-internals-the-dictionary-a32c14e73efa](https://medium.freecodecamp.org/exploring-python-internals-the-dictionary-a32c14e73efa)
​
What do you guys think?
/r/Python
https://redd.it/ba2n9v
If you ever wondered how Python handles some of its data structures :)
​
[https://medium.freecodecamp.org/exploring-python-internals-the-dictionary-a32c14e73efa](https://medium.freecodecamp.org/exploring-python-internals-the-dictionary-a32c14e73efa)
​
What do you guys think?
/r/Python
https://redd.it/ba2n9v
freeCodeCamp.org
Upgrade your Python skills: Examining the Dictionary
By Adam Goldschmidt a hash table (hash map) is a data structure that implements an associative array abstract data type, a structure that can map keys to values. If it smells like a Python dict, feels like a dict, and looks like one… well, it must ...
PSA: About 48 hours left to grab the humble coder's bookshelf bundle containing 4 Python specific titles
https://twitter.com/Pythonresourcehub/status/1114529100113371136
/r/Python
https://redd.it/ba617z
https://twitter.com/Pythonresourcehub/status/1114529100113371136
/r/Python
https://redd.it/ba617z
Twitter
Purple Hub
Humble Bundle: Coder's bookshelf by @nostarch ✅ Python, R, other languages, general programming and related titles $439 worth of value for $20 or less! Sales support charity. Over 21,403 bundles sold 🙏 https://t.co/NV8VjCNTiE Hurry, bundle ending 4/8 10 am…
Django Views + Vue.js - do I need DRF?
I'm dipping my toes into adding some responsivness via Vue.js. Most of the tutorials I'm finding are Vue.JS + DRF. I already have a bunch of views and it seems silly to rewrite everything to support Vue.js.
The few tutorials I have found on Vue + Django views are focused on getting and display data. Does anyone have any example repos that show form handling?
​
/r/django
https://redd.it/ba3wad
I'm dipping my toes into adding some responsivness via Vue.js. Most of the tutorials I'm finding are Vue.JS + DRF. I already have a bunch of views and it seems silly to rewrite everything to support Vue.js.
The few tutorials I have found on Vue + Django views are focused on getting and display data. Does anyone have any example repos that show form handling?
​
/r/django
https://redd.it/ba3wad
reddit
r/django - Django Views + Vue.js - do I need DRF?
11 votes and 13 comments so far on Reddit
Python Positional-Only Parameters, has been accepted
[PEP-570](https://www.python.org/dev/peps/pep-0570/) has been accepted. This introduces `/` as a marker to indicate that the arguments to its left are positional only. Similar to how `*` indicates the arguments to the right are keyword only. A couple of simple examples would be,
```python
def name(p1, p2, /): ...
name(1, 2) # Fine
name(1, p2=2) # Not allowed
def name2(p1, p2, /, p_or_kw): ...
name2(1, 2, 3) # Fine
name2(1, 2, p_or_kw=3) # Fine
name2(1, p2=2, p_or_kw=3) # Not allowed
```
(I'm not involved in the PEP, just thought this sub would be interested).
/r/Python
https://redd.it/ba6scp
[PEP-570](https://www.python.org/dev/peps/pep-0570/) has been accepted. This introduces `/` as a marker to indicate that the arguments to its left are positional only. Similar to how `*` indicates the arguments to the right are keyword only. A couple of simple examples would be,
```python
def name(p1, p2, /): ...
name(1, 2) # Fine
name(1, p2=2) # Not allowed
def name2(p1, p2, /, p_or_kw): ...
name2(1, 2, 3) # Fine
name2(1, 2, p_or_kw=3) # Fine
name2(1, p2=2, p_or_kw=3) # Not allowed
```
(I'm not involved in the PEP, just thought this sub would be interested).
/r/Python
https://redd.it/ba6scp
Python Enhancement Proposals (PEPs)
PEP 570 – Python Positional-Only Parameters | peps.python.org
This PEP proposes to introduce a new syntax, /, for specifying positional-only parameters in Python function definitions.
Update on my Bot that creates Youtube-Videos
Hey guys,
I already posted about this once last week, [here](https://old.reddit.com/r/Python/comments/b7siec/i_made_a_video_creating_script_with_python/) ,basically I created a script which takes askreddit threads and makes youtube videos out of them.
Now I did make some improvments, e.g. spaced out the comments so the reader pauses and would be happy to hear some feedback from you guys.
Here are my 2 new videos both on the same askreddit thread, one with old google tts and one with the better google tts although not wavenet:
[Standard](https://www.youtube.com/watch?v=H55aJjQiuXA)
[Newer Google tts](https://www.youtube.com/watch?v=jjKG9uAZwiM)
Looking forward to your feedback :)
/r/Python
https://redd.it/ba85zh
Hey guys,
I already posted about this once last week, [here](https://old.reddit.com/r/Python/comments/b7siec/i_made_a_video_creating_script_with_python/) ,basically I created a script which takes askreddit threads and makes youtube videos out of them.
Now I did make some improvments, e.g. spaced out the comments so the reader pauses and would be happy to hear some feedback from you guys.
Here are my 2 new videos both on the same askreddit thread, one with old google tts and one with the better google tts although not wavenet:
[Standard](https://www.youtube.com/watch?v=H55aJjQiuXA)
[Newer Google tts](https://www.youtube.com/watch?v=jjKG9uAZwiM)
Looking forward to your feedback :)
/r/Python
https://redd.it/ba85zh
reddit
r/Python - I made a video creating script with python
3 votes and 1 comment so far on Reddit
My first open-source project. An ASCII art generator
I've been using python for a while, but I struggle to think of more ambitious projects, so most of my projects are very, very simple. But this time I've tried to make something a little more complicated (granted, it's not that complicated, just a little more complex than my usual project), so I made an ASCII art generator, that takes an image of any type and converts it to ASCII art. This is also the first time I am releasing my code on Github for other people to use.
I'm posting this here to see if anyone can make suggestions on how to improve the code, and see if there is anything wrong with it (so basically a code review).
​
[Github link](https://github.com/purrleterian/Image-to-ASCII-art-converter)
/r/Python
https://redd.it/bab3r9
I've been using python for a while, but I struggle to think of more ambitious projects, so most of my projects are very, very simple. But this time I've tried to make something a little more complicated (granted, it's not that complicated, just a little more complex than my usual project), so I made an ASCII art generator, that takes an image of any type and converts it to ASCII art. This is also the first time I am releasing my code on Github for other people to use.
I'm posting this here to see if anyone can make suggestions on how to improve the code, and see if there is anything wrong with it (so basically a code review).
​
[Github link](https://github.com/purrleterian/Image-to-ASCII-art-converter)
/r/Python
https://redd.it/bab3r9
GitHub
purrleterian/Image-to-ASCII-art-converter
Converts an image of any type to an ASCII art representation of the same image. - purrleterian/Image-to-ASCII-art-converter
[D] Tensoflow 2.0 vs. Keras
Okay I'm just gonna come out and say it. I don't get it. All the marketing and Medium articles make Tensorflow 2.0 sound like everything has been streamlined (which would be greatly appreciated), but if you look at the API documentation nothing seems to have been taken out. The main difference I can see is that the tutorials now use tf.keras as the preferred method of doing things. I'm mostly okay with this as Keras is much more intuitive when it comes to building neural networks, but if they're using the tf.keras namespace, aren't we really just using Keras? I feel like I'm being tricked or something.
Now, I am admittedly something of a relative beginner when it comes to ML and TF especially so maybe I don't understand the nuances, but I would have thought that TF 2.0 would have changed the entire API to be more like that of Keras or PyTorch instead of just changing the docs to tell me to use tf.keras. Am I actually just using Keras with the ability to do more advanced things or is it still Tensorflow?
Sorry if this doesn't make a lot of sense or isn't the right place for this, I
/r/MachineLearning
https://redd.it/ba9h3g
Okay I'm just gonna come out and say it. I don't get it. All the marketing and Medium articles make Tensorflow 2.0 sound like everything has been streamlined (which would be greatly appreciated), but if you look at the API documentation nothing seems to have been taken out. The main difference I can see is that the tutorials now use tf.keras as the preferred method of doing things. I'm mostly okay with this as Keras is much more intuitive when it comes to building neural networks, but if they're using the tf.keras namespace, aren't we really just using Keras? I feel like I'm being tricked or something.
Now, I am admittedly something of a relative beginner when it comes to ML and TF especially so maybe I don't understand the nuances, but I would have thought that TF 2.0 would have changed the entire API to be more like that of Keras or PyTorch instead of just changing the docs to tell me to use tf.keras. Am I actually just using Keras with the ability to do more advanced things or is it still Tensorflow?
Sorry if this doesn't make a lot of sense or isn't the right place for this, I
/r/MachineLearning
https://redd.it/ba9h3g
reddit
r/MachineLearning - [D] Tensoflow 2.0 vs. Keras
88 votes and 32 comments so far on Reddit