I wrote a script to monitor COVID cases in a specific country and send travel recommendation to WhatsApp (less than 50 lines of Python)
Hey,
So one of my friends wanted to go to Japan, but he was worried about the COVID situation. He was checking the [number of confirmed cases](https://coronavirus.jhu.edu/map.html) daily to see when they start to go down. I decided to write a piece of Python code to automate it.
This is [the code](https://github.com/seamless-io/templates/tree/master/monitor_country_covid_status). It turned out to be less than 50 lines.
And this is [this blog post](https://medium.com/seamless-cloud/monitor-covid-cases-using-python-in-less-than-50-lines-of-code-810e9b7ab56c) with a more detailed explanation of the code.
Disclaimer: I'm the creator of one of the services mentioned in the blog post (https://www.seamlesscloud.io/). But the code is just Python so you can use it however you want.
/r/Python
https://redd.it/id6dq7
Hey,
So one of my friends wanted to go to Japan, but he was worried about the COVID situation. He was checking the [number of confirmed cases](https://coronavirus.jhu.edu/map.html) daily to see when they start to go down. I decided to write a piece of Python code to automate it.
This is [the code](https://github.com/seamless-io/templates/tree/master/monitor_country_covid_status). It turned out to be less than 50 lines.
And this is [this blog post](https://medium.com/seamless-cloud/monitor-covid-cases-using-python-in-less-than-50-lines-of-code-810e9b7ab56c) with a more detailed explanation of the code.
Disclaimer: I'm the creator of one of the services mentioned in the blog post (https://www.seamlesscloud.io/). But the code is just Python so you can use it however you want.
/r/Python
https://redd.it/id6dq7
Johns Hopkins Coronavirus Resource Center
COVID-19 Map - Johns Hopkins Coronavirus Resource Center
Coronavirus COVID-19 Global Cases by the Center for Systems Science and Engineering (CSSE) at Johns Hopkins University (JHU)
Django Async: What's new and what's next?
https://deepsource.io/blog/django-async-support/
/r/django
https://redd.it/id7tyy
https://deepsource.io/blog/django-async-support/
/r/django
https://redd.it/id7tyy
DeepSource
Django Async: What's new and what's next?
With Django 3.1, you can put async code in production if you don’t have to do heavy-lifting with some parts of Django that don’t support async yet.
Drug Inventory system
Any suggestions for how to map a Drug table with a Movement table in a sqlalchemy table
/r/flask
https://redd.it/id9vfl
Any suggestions for how to map a Drug table with a Movement table in a sqlalchemy table
/r/flask
https://redd.it/id9vfl
reddit
Drug Inventory system
Any suggestions for how to map a Drug table with a Movement table in a sqlalchemy table
Analyzing Python Code with Python
https://rotemtam.com/2020/08/13/python-ast/
/r/Python
https://redd.it/idb8r3
https://rotemtam.com/2020/08/13/python-ast/
/r/Python
https://redd.it/idb8r3
reddit
Analyzing Python Code with Python
Posted in r/Python by u/ASIC_SP • 35 points and 5 comments
Python Flask job in 15 y.o
Hi everyone, I have been learning Flask framework for more then one year, and I think I have pretty good experience, but I have a problem finding Flask backend job without completed high school or university. What should I do to make some money with Flask?
Thanks for your opinion
/r/flask
https://redd.it/idg0z3
Hi everyone, I have been learning Flask framework for more then one year, and I think I have pretty good experience, but I have a problem finding Flask backend job without completed high school or university. What should I do to make some money with Flask?
Thanks for your opinion
/r/flask
https://redd.it/idg0z3
reddit
Python Flask job in 15 y.o
Hi everyone, I have been learning Flask framework for more then one year, and I think I have pretty good experience, but I have a problem finding...
Flask to break into freelance?
Hi all,
I've been learning Python for around a year (actually off & on over the last 5 years), and have done some side projects at work involving .csv's and automation. More recently, I've played around with Flask and built a simple site called spacewa.com ... I am interested in moving into freelance, and hopefully, a full time dev job. I've got a bit of Linux and AWS experience, along with Python & Flask, already mentioned. I would be looking for remote work mostly likely--is Flask a way to get my foot in the door? Could I realistically start building some basic sites or API's as a freelancer? What is the market like?
Many thanks!
/r/flask
https://redd.it/idjyk9
Hi all,
I've been learning Python for around a year (actually off & on over the last 5 years), and have done some side projects at work involving .csv's and automation. More recently, I've played around with Flask and built a simple site called spacewa.com ... I am interested in moving into freelance, and hopefully, a full time dev job. I've got a bit of Linux and AWS experience, along with Python & Flask, already mentioned. I would be looking for remote work mostly likely--is Flask a way to get my foot in the door? Could I realistically start building some basic sites or API's as a freelancer? What is the market like?
Many thanks!
/r/flask
https://redd.it/idjyk9
reddit
Flask to break into freelance?
Hi all, I've been learning Python for around a year (actually off & on over the last 5 years), and have done some side projects at work involving...
Please excuse my level of inexperience and help me out please
I’m currently trying to deploy a very very basic website if you can even call it that to heroku just to make sure it’ll work. I was able to successfully load my one index.html file located in a templates folder within the GitHub repository I am using to deploy. The file contains links to other html files within that same templates folder. Now the index.html file loads fine but the links to the html files result in a Not Found Error.
My current app.py program looks like this:
#DEPLOY VERSION_v1.0.1 null(1)
from flask import Flask, render_template, request
from flask_sqlalchemy import SQLAlchemy
app= Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
if __name__ == '__main__':
app.run()
How would I go about fixing this error?
P.s. you can ignore my import lines at the very beginning, they’re for use later.
/r/flask
https://redd.it/id61ka
I’m currently trying to deploy a very very basic website if you can even call it that to heroku just to make sure it’ll work. I was able to successfully load my one index.html file located in a templates folder within the GitHub repository I am using to deploy. The file contains links to other html files within that same templates folder. Now the index.html file loads fine but the links to the html files result in a Not Found Error.
My current app.py program looks like this:
#DEPLOY VERSION_v1.0.1 null(1)
from flask import Flask, render_template, request
from flask_sqlalchemy import SQLAlchemy
app= Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
if __name__ == '__main__':
app.run()
How would I go about fixing this error?
P.s. you can ignore my import lines at the very beginning, they’re for use later.
/r/flask
https://redd.it/id61ka
reddit
Please excuse my level of inexperience and help me out please
I’m currently trying to deploy a very very basic website if you can even call it that to heroku just to make sure it’ll work. I was able to...
Simple plugin to create easily editable tables.
Hello. I need ability to simply and easily to create HTML tables. Easy edit ability would be key. Is there a django plugin that allows easily create tables in the admin page and then storing them into the database.
The idea is kinda like having blog where sometimes instead of just posting image and some text and table displaying some simple data.
/r/django
https://redd.it/idj826
Hello. I need ability to simply and easily to create HTML tables. Easy edit ability would be key. Is there a django plugin that allows easily create tables in the admin page and then storing them into the database.
The idea is kinda like having blog where sometimes instead of just posting image and some text and table displaying some simple data.
/r/django
https://redd.it/idj826
reddit
Simple plugin to create easily editable tables.
Hello. I need ability to simply and easily to create HTML tables. Easy edit ability would be key. Is there a django plugin that allows easily...
Blog Application | Django 3.0 For Beginners
https://youtu.be/Rq0RabmlDSk
/r/django
https://redd.it/idiznx
https://youtu.be/Rq0RabmlDSk
/r/django
https://redd.it/idiznx
YouTube
Blog Application | Django 3.0 For Beginners 🔥
How to Build a Django Blog Application with STEP-BY-STEP ?0:00 Introduction of Blog Website.3:40 Prerequisite4:10 Django 3 Introduction7:20 Installation pyth...
I want to show "username/password are incorrect" after user input incorrect password. How to show that message? can someone help me?? Below is the code of login in views.
​
def login(request):
if request.method == 'POST':
form = AuthenticationForm(data=request.POST)
if form.is\_valid():
user = form.get\_user()
authlog(request, user)
return redirect('users')
else:
back\_page = request.META.get('HTTP\_REFERER')
return redirect('login')
\# return HttpResponse(back\_page)
/r/django
https://redd.it/idrt0w
​
def login(request):
if request.method == 'POST':
form = AuthenticationForm(data=request.POST)
if form.is\_valid():
user = form.get\_user()
authlog(request, user)
return redirect('users')
else:
back\_page = request.META.get('HTTP\_REFERER')
return redirect('login')
\# return HttpResponse(back\_page)
/r/django
https://redd.it/idrt0w
reddit
I want to show "username/password are incorrect" after user input...
def login(request): if request.method == 'POST': form = AuthenticationForm(data=request.POST) if form.is\_valid(): user =...
[D] A good resource for MLE interivew
Hi,
If you're preparing for an interview, you might want to check out: [https://github.com/khangich/machine-learning-interview](https://github.com/khangich/machine-learning-interview)
I compiled this from my actual interview experiences. Hope it helps. I'm still looking for good material about A/B testing and MultiArm bandit. I appreciate it if you can give me some links.
​
I originally posted in r/learnmachinelearning but I think there will be more experts here that can help and give feedback.
Cheers.
/r/MachineLearning
https://redd.it/idr5be
Hi,
If you're preparing for an interview, you might want to check out: [https://github.com/khangich/machine-learning-interview](https://github.com/khangich/machine-learning-interview)
I compiled this from my actual interview experiences. Hope it helps. I'm still looking for good material about A/B testing and MultiArm bandit. I appreciate it if you can give me some links.
​
I originally posted in r/learnmachinelearning but I think there will be more experts here that can help and give feedback.
Cheers.
/r/MachineLearning
https://redd.it/idr5be
GitHub
GitHub - khangich/machine-learning-interview: Machine Learning Interviews from FAANG, Snapchat, LinkedIn. I have offers from Snapchat…
Machine Learning Interviews from FAANG, Snapchat, LinkedIn. I have offers from Snapchat, Coupang, Stitchfix etc. Blog: mlengineer.io. - khangich/machine-learning-interview
Convert python script to Jupyter and save the output in html
I have a python script, which takes --daysparams and outputs graphs for the range, i want to convert this python script to Jupyter notebook and execute the code and save the output in html format.
>parser = argparse.ArgumentParser()
>
>parser.add\_argument( "--days", type=int, default=1, help="Specify number of days data needed, else defaults to 1 day", )
>
>args = parser.parse\_args()
above lines gets saved in a Jupyter cell on conversion, how do pass the days argument while executing the jupyter notebook ?
Used papermill for execution and ran into the below error:
>Output Notebook: mynotebook\_output.ipynb Executing: 0%| | 0/13 \[00:00<?, ?cell/s\]Executing notebook with kernel: python3 Executing: 15%|███████████▊ | 2/13 \[00:01<00:09, 1.17cell/s\] Traceback (most recent call last): File "/home/sanju/.local/bin/papermill", line 8, in <module> sys.exit(papermill()) File "/home/sanju/.local/lib/python3.6/site-packages/click/core.py", line 829, in \_\_call\_\_ return self.main(\*args, \*\*kwargs) File "/home/sanju/.local/lib/python3.6/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/home/sanju/.local/lib/python3.6/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, \*\*ctx.params) File "/home/sanju/.local/lib/python3.6/site-packages/click/core.py", line 610, in invoke return callback(\*args, \*\*kwargs) File "/home/sanju/.local/lib/python3.6/site-packages/papermill/cli.py", line 238, in papermill execution\_timeout=execution\_timeout, File "/home/sanju/.local/lib/python3.6/site-packages/papermill/execute.py", line 110,
/r/JupyterNotebooks
https://redd.it/idtnm4
I have a python script, which takes --daysparams and outputs graphs for the range, i want to convert this python script to Jupyter notebook and execute the code and save the output in html format.
>parser = argparse.ArgumentParser()
>
>parser.add\_argument( "--days", type=int, default=1, help="Specify number of days data needed, else defaults to 1 day", )
>
>args = parser.parse\_args()
above lines gets saved in a Jupyter cell on conversion, how do pass the days argument while executing the jupyter notebook ?
Used papermill for execution and ran into the below error:
>Output Notebook: mynotebook\_output.ipynb Executing: 0%| | 0/13 \[00:00<?, ?cell/s\]Executing notebook with kernel: python3 Executing: 15%|███████████▊ | 2/13 \[00:01<00:09, 1.17cell/s\] Traceback (most recent call last): File "/home/sanju/.local/bin/papermill", line 8, in <module> sys.exit(papermill()) File "/home/sanju/.local/lib/python3.6/site-packages/click/core.py", line 829, in \_\_call\_\_ return self.main(\*args, \*\*kwargs) File "/home/sanju/.local/lib/python3.6/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/home/sanju/.local/lib/python3.6/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, \*\*ctx.params) File "/home/sanju/.local/lib/python3.6/site-packages/click/core.py", line 610, in invoke return callback(\*args, \*\*kwargs) File "/home/sanju/.local/lib/python3.6/site-packages/papermill/cli.py", line 238, in papermill execution\_timeout=execution\_timeout, File "/home/sanju/.local/lib/python3.6/site-packages/papermill/execute.py", line 110,
/r/JupyterNotebooks
https://redd.it/idtnm4
reddit
Convert python script to Jupyter and save the output in html
Posted in r/JupyterNotebooks by u/sanpoke18 • 1 point and 0 comments
Are there free alternatives to Twilio for SMS notifications?
I want to do SMS notifications from my Django app, but it seems like the standard is Twilio’s paid service. Just curious before I go this route, are there any free alternatives anyone can recommend?
I’m already paying $20 a month for proxies, and $5 a month for Digital Ocean, so I’d like to keep further costs to a minimum if possible.
/r/django
https://redd.it/idx56p
I want to do SMS notifications from my Django app, but it seems like the standard is Twilio’s paid service. Just curious before I go this route, are there any free alternatives anyone can recommend?
I’m already paying $20 a month for proxies, and $5 a month for Digital Ocean, so I’d like to keep further costs to a minimum if possible.
/r/django
https://redd.it/idx56p
reddit
Are there free alternatives to Twilio for SMS notifications?
I want to do SMS notifications from my Django app, but it seems like the standard is Twilio’s paid service. Just curious before I go this route,...
Friday megathread: Free chat Friday!
Use this thread to talk about anything Python related! Questions, news, projects and any relevant discussion around Python is permitted!
/r/Python
https://redd.it/idlz52
Use this thread to talk about anything Python related! Questions, news, projects and any relevant discussion around Python is permitted!
/r/Python
https://redd.it/idlz52
reddit
Friday megathread: Free chat Friday!
Use this thread to talk about anything Python related! Questions, news, projects and any relevant discussion around Python is permitted!
Missing the Scripts folder in Anaconda
Hey guys! I don't know if this is the right sub for this question, but I've tried to download Anaconda to my Windows (10, 64-bit) and its missing the Scripts folder no matter how many times I uninstall and reinstall it. So I also don't have the navigator or the prompt files. Can you guys recommend me somethi g to solve this problem?
/r/JupyterNotebooks
https://redd.it/idi25r
Hey guys! I don't know if this is the right sub for this question, but I've tried to download Anaconda to my Windows (10, 64-bit) and its missing the Scripts folder no matter how many times I uninstall and reinstall it. So I also don't have the navigator or the prompt files. Can you guys recommend me somethi g to solve this problem?
/r/JupyterNotebooks
https://redd.it/idi25r
reddit
Missing the Scripts folder in Anaconda
Hey guys! I don't know if this is the right sub for this question, but I've tried to download Anaconda to my Windows (10, 64-bit) and its missing...
Why is my JWT access token saved into my cookies when I log in manually from the back end, but not from the front end?
So, I'm using GatsbyJS on the front end on port 8000 and Django REST Framework on the back end on port 7000. All I want to do is sign the user in using their username and password as credentials. I'm using a combination of `dj-rest-auth` and `all-auth` to handle JWT authentication. Here are the paths I've created:
* Registration: `/auth/registration/`
* Logging In: `/auth/login/`
* Logging Out: `/auth/logout/`
* Getting Current User Information: `/auth/user/`
When I log the user in from the back end (`localhost:7000/auth/login/`), I get back the access token, refresh token, and relevant user data (e.g. id, username, email, etc.). When I log the user in from the front end (`localhost:8000` \- code below), I get the exact same data back from [`response.data`](https://response.data) \- access token, refresh token, and relevant user data. The only difference between the two is that, when I log in from the back end endpoint, the access token is safely stored within an HttpOnly cookie. However, when I log in from the front end (i.e. hit `localhost:7000/auth/login/` using Axios), while I get back the same response data, my access token isn't being saved into an HttpOnly cookie, let alone being saved on the browser at all. When trying to
/r/django
https://redd.it/idxr6p
So, I'm using GatsbyJS on the front end on port 8000 and Django REST Framework on the back end on port 7000. All I want to do is sign the user in using their username and password as credentials. I'm using a combination of `dj-rest-auth` and `all-auth` to handle JWT authentication. Here are the paths I've created:
* Registration: `/auth/registration/`
* Logging In: `/auth/login/`
* Logging Out: `/auth/logout/`
* Getting Current User Information: `/auth/user/`
When I log the user in from the back end (`localhost:7000/auth/login/`), I get back the access token, refresh token, and relevant user data (e.g. id, username, email, etc.). When I log the user in from the front end (`localhost:8000` \- code below), I get the exact same data back from [`response.data`](https://response.data) \- access token, refresh token, and relevant user data. The only difference between the two is that, when I log in from the back end endpoint, the access token is safely stored within an HttpOnly cookie. However, when I log in from the front end (i.e. hit `localhost:7000/auth/login/` using Axios), while I get back the same response data, my access token isn't being saved into an HttpOnly cookie, let alone being saved on the browser at all. When trying to
/r/django
https://redd.it/idxr6p
How to generate card token in a react native app?
Hi I am trying to develop a mobile app using react native and Django. From docs I got to know about the ensure_csrf_token decorator but I have no idea how to generate csrf token in a mobile app. Also which url should I white list in the settings.py file to enable my react native app to fetch data from the Django server. I am using drf btw
/r/djangolearning
https://redd.it/ie1i7c
Hi I am trying to develop a mobile app using react native and Django. From docs I got to know about the ensure_csrf_token decorator but I have no idea how to generate csrf token in a mobile app. Also which url should I white list in the settings.py file to enable my react native app to fetch data from the Django server. I am using drf btw
/r/djangolearning
https://redd.it/ie1i7c
reddit
How to generate card token in a react native app?
Hi I am trying to develop a mobile app using react native and Django. From docs I got to know about the ensure_csrf_token decorator but I have no...
Snake game in a single line of python
This is a fully functional game of snake in a single line of python using pygame. I did this mostly as a challenge to myself to see how compact I can make code, similar to code golf. I got it down to less than 3K characters, but I could easily get much less by shortening variable names.
[source code](https://github.com/tjf801/oneliners/blob/master/snake.py)
edit: some bug fixes made it go over 3K chars
/r/Python
https://redd.it/idxmnt
This is a fully functional game of snake in a single line of python using pygame. I did this mostly as a challenge to myself to see how compact I can make code, similar to code golf. I got it down to less than 3K characters, but I could easily get much less by shortening variable names.
[source code](https://github.com/tjf801/oneliners/blob/master/snake.py)
edit: some bug fixes made it go over 3K chars
/r/Python
https://redd.it/idxmnt
GitHub
oneliners/snake.py at master · tjf801/oneliners
one line of python code to impliment algorithms. Contribute to tjf801/oneliners development by creating an account on GitHub.
django celery
Hi, I'm trying out celery and it works but it seems like celery does not complete the task. I've checked celery docs and it seems like there isn't a time limit set on completing the task.
user = User.objects.get(id=user_id)
scraperecord = ScrapeRecord.objects.create(user=user, query=query)
print(article_elements)
for article in article_elements:
h2 = article.find_element_by_tag_name("h2")
article_title = h2.text
if re.match('^person', article_title):
continue
a =
/r/django
https://redd.it/ie1l6q
Hi, I'm trying out celery and it works but it seems like celery does not complete the task. I've checked celery docs and it seems like there isn't a time limit set on completing the task.
user = User.objects.get(id=user_id)
scraperecord = ScrapeRecord.objects.create(user=user, query=query)
print(article_elements)
for article in article_elements:
h2 = article.find_element_by_tag_name("h2")
article_title = h2.text
if re.match('^person', article_title):
continue
a =
/r/django
https://redd.it/ie1l6q
reddit
django celery
Hi, I'm trying out celery and it works but it seems like celery does not complete the task. I've checked celery docs and it seems like there isn't...
Saturday megathread: Share your resources!
Found a neat resource related to Python over the past week? Looking for a resource to explain a certain topic?
Use this thread to chat about and share Python resources!
/r/Python
https://redd.it/ie8bg0
Found a neat resource related to Python over the past week? Looking for a resource to explain a certain topic?
Use this thread to chat about and share Python resources!
/r/Python
https://redd.it/ie8bg0
reddit
Saturday megathread: Share your resources!
Found a neat resource related to Python over the past week? Looking for a resource to explain a certain topic? Use this thread to chat about and...