How to pass port as parameter?
I saw in docs that you can pass port number as parameter -p, like:
python3 "/.../routes.py" -p 5003
but it isn't working for me!
/r/flask
https://redd.it/b6n437
I saw in docs that you can pass port number as parameter -p, like:
python3 "/.../routes.py" -p 5003
but it isn't working for me!
/r/flask
https://redd.it/b6n437
reddit
r/flask - How to pass port as parameter?
0 votes and 0 comments so far on Reddit
Advanced web scraping in pythong using Scrapy
So I've been trying to teach myself web scraping, I can do basic, normal webscraping completely fine but now I want to teach myself how to scrape a website that has anti-webscraping mechanisms.
So I chose this website: [https://sneakersnstuff.com/en/858/new-arrivals](https://www.sneakersnstuff.com/en/858/new-arrivals)
​
I previously tried scraping proxies from: [https://free-proxy-list.net/](https://free-proxy-list.net/) then use these proxies to try and scrape the above website link with BeautifySoup and requests but got 403, and even with Scrapy so far I have been getting 403 FORBIDDEN HTTP status code, meaning that I haven't passed through their anti-webscraping mechanism.
So I want to know any suggestions, tips and tricks explained in a beginner-friendly way with a code example, to achieve this feat.
/r/Python
https://redd.it/b6i2ya
So I've been trying to teach myself web scraping, I can do basic, normal webscraping completely fine but now I want to teach myself how to scrape a website that has anti-webscraping mechanisms.
So I chose this website: [https://sneakersnstuff.com/en/858/new-arrivals](https://www.sneakersnstuff.com/en/858/new-arrivals)
​
I previously tried scraping proxies from: [https://free-proxy-list.net/](https://free-proxy-list.net/) then use these proxies to try and scrape the above website link with BeautifySoup and requests but got 403, and even with Scrapy so far I have been getting 403 FORBIDDEN HTTP status code, meaning that I haven't passed through their anti-webscraping mechanism.
So I want to know any suggestions, tips and tricks explained in a beginner-friendly way with a code example, to achieve this feat.
/r/Python
https://redd.it/b6i2ya
free-proxy-list.net
Free Proxy List - Just Checked Proxy List
Here are the latest 300 free proxies that are just checked and added into our proxy list. The proxy list is updated every 10 minutes to keep fresh.
[R] Implementation of Neural Ordinary Differential Equations [slides + notebooks + code]
Hi, sharing with my slides and notebooks on NeuralODE. During my talk I put stress on explaining what are ordinary differential equations, how to solve them numerically (how to implement simple black box solver), how to integrate ODE when problem function is given by Neural Network, how to compute gradients with adjoint method vs naive approach. Finally, what are Continuous Normalizing Flows derived in the paper.
Link to repo: [github/2019-03-Neural-Ordinary-Differential-Equations](https://github.com/kmkolasinski/deep-learning-notes/tree/master/seminars/2019-03-Neural-Ordinary-Differential-Equations)
In the repo you can find:
* tensorflow implementation of NeuralODE (eager mode + keras API) - however for the sake of simplicity I implemented only few fixed grid solvers i.e. Euler, RK2 and RK4
* jupyter notebooks which show how to implement black-box ODE solver, integrate NN with it, how to use adjoint method to optimize bullet trajectory etc
* re-implementation of Continuous Normalizing Flows:
[Example result obtained with Continuous Normalizing Flows \(two moons problem from paper\)](https://i.redd.it/pjoslv7xrto21.gif)
​
/r/MachineLearning
https://redd.it/b6ghg3
Hi, sharing with my slides and notebooks on NeuralODE. During my talk I put stress on explaining what are ordinary differential equations, how to solve them numerically (how to implement simple black box solver), how to integrate ODE when problem function is given by Neural Network, how to compute gradients with adjoint method vs naive approach. Finally, what are Continuous Normalizing Flows derived in the paper.
Link to repo: [github/2019-03-Neural-Ordinary-Differential-Equations](https://github.com/kmkolasinski/deep-learning-notes/tree/master/seminars/2019-03-Neural-Ordinary-Differential-Equations)
In the repo you can find:
* tensorflow implementation of NeuralODE (eager mode + keras API) - however for the sake of simplicity I implemented only few fixed grid solvers i.e. Euler, RK2 and RK4
* jupyter notebooks which show how to implement black-box ODE solver, integrate NN with it, how to use adjoint method to optimize bullet trajectory etc
* re-implementation of Continuous Normalizing Flows:
[Example result obtained with Continuous Normalizing Flows \(two moons problem from paper\)](https://i.redd.it/pjoslv7xrto21.gif)
​
/r/MachineLearning
https://redd.it/b6ghg3
GitHub
kmkolasinski/deep-learning-notes
Experiments with Deep Learning. Contribute to kmkolasinski/deep-learning-notes development by creating an account on GitHub.
Admin page not displaying list_display
I'm working through MDN's tutorial on Django and I'm up to the Admin page stuff.
I am trying to register my Author model in my admin pages like so:
from django.contrib import admin
from .models import Author
@admin.register(Author)
class AuthorAdmin(admin.ModelAdmin):
list_display = ('last_name', 'first_name', 'date_of_birth', 'date_of_death')
When I go to `localhost:8000/admin/catalog/author` I'm still seeing the `__str__()` representation of the model. What am I getting wrong?
/r/djangolearning
https://redd.it/b6ozi7
I'm working through MDN's tutorial on Django and I'm up to the Admin page stuff.
I am trying to register my Author model in my admin pages like so:
from django.contrib import admin
from .models import Author
@admin.register(Author)
class AuthorAdmin(admin.ModelAdmin):
list_display = ('last_name', 'first_name', 'date_of_birth', 'date_of_death')
When I go to `localhost:8000/admin/catalog/author` I'm still seeing the `__str__()` representation of the model. What am I getting wrong?
/r/djangolearning
https://redd.it/b6ozi7
reddit
r/djangolearning - Admin page not displaying list_display
0 votes and 0 comments so far on Reddit
Django app getting pinged by bots looking for vulnerabilities--what should I be doing in response for security(site on Heroku behind Cloudflare)?
Hey all, have a django site running on heroku behind cloudflare and noticed in the logs that site is often getting pinged by bots looking for vulnerabilities (ie. queries to mysite.com/wp-login or mysite.com/com/fileuploader etc.). It's not that frequent that it's a DDOS, these all show 404 error codes so I think they just don't get through, and most of the pings are for wordpress sites anyway.
I'm wondering if I should be doing anything to prevent these attacks or ban these ips? I am on the Cloudflare plan with the WAF. Cloudflare has an option in the WAF to ban certain IPs, should I be adding these IPs to that list(any way to automate this?) or something else? Just wondering if there's a best practice here. Thank you all.
/r/django
https://redd.it/b6p8nu
Hey all, have a django site running on heroku behind cloudflare and noticed in the logs that site is often getting pinged by bots looking for vulnerabilities (ie. queries to mysite.com/wp-login or mysite.com/com/fileuploader etc.). It's not that frequent that it's a DDOS, these all show 404 error codes so I think they just don't get through, and most of the pings are for wordpress sites anyway.
I'm wondering if I should be doing anything to prevent these attacks or ban these ips? I am on the Cloudflare plan with the WAF. Cloudflare has an option in the WAF to ban certain IPs, should I be adding these IPs to that list(any way to automate this?) or something else? Just wondering if there's a best practice here. Thank you all.
/r/django
https://redd.it/b6p8nu
defer and some concurrency [AF]
Hey everyone,
I've got a request that does a large amount of insertions in a psql db. This takes quite some time and results in the request/response cycle returning a tiimeout. Someone a lot more knowledgable than I'll ever be suggested flask_defer but for the life of me I can't get it to provide the response back to the client prior to inserting the data into the database. I've seen the likes of celery and python-rq. Although these seem scary and like way too much to simply have a task running in the background with me being the sole client to access this site.
So just to lay out the problem better. Every evening I'll automatically start submitting data to the database. The insertion of the data takes quite some time and thus the response isn't returned in a timely manner. The site will only be used by me, so it won't be receiving a lot of attention. I want it to be able to return the response prior to doing the database insertions. Some level of concurrency will be needed as when flask returns the response, I'll immediately start another request, to insert another set of data, and if the prior
/r/flask
https://redd.it/b45634
Hey everyone,
I've got a request that does a large amount of insertions in a psql db. This takes quite some time and results in the request/response cycle returning a tiimeout. Someone a lot more knowledgable than I'll ever be suggested flask_defer but for the life of me I can't get it to provide the response back to the client prior to inserting the data into the database. I've seen the likes of celery and python-rq. Although these seem scary and like way too much to simply have a task running in the background with me being the sole client to access this site.
So just to lay out the problem better. Every evening I'll automatically start submitting data to the database. The insertion of the data takes quite some time and thus the response isn't returned in a timely manner. The site will only be used by me, so it won't be receiving a lot of attention. I want it to be able to return the response prior to doing the database insertions. Some level of concurrency will be needed as when flask returns the response, I'll immediately start another request, to insert another set of data, and if the prior
/r/flask
https://redd.it/b45634
reddit
r/flask - defer and some concurrency [AF]
1 vote and 4 comments so far on Reddit
Getting data from dynamically created inputs
I have some code where I can dynamically add inputs via javascript code. But I'm unable to figure out how to get the data from the input boxes created. How can I get the data back into my python scripts? Do I have to do this with JS?
EDIT: So I found a solution.
In my forms.py I utilize a HiddenField(). Then in my javascript I take my addCount var used in generating the input boxes and store that value into my HiddenField. Then from my routes.py I am able to access the HiddenField data via request.form.get('hiddenNum'). Once I have that value, I can loop over the range to generate the names for each added input box.
Forms:
class SubDirForm(FlaskForm):
subDirName = TextField(validators=[DataRequired()])
class SubDirsForm(FlaskForm):
subDirList = FieldList(FormField(SubDirForm), min_entries=0)
submit = SubmitField(label='Print')
addField = ButtonField(label='Add Field', id='addNewField')
hiddenNum = HiddenField()
Route:
@bp.route('/', methods=['GET', 'POST'])
/r/flask
https://redd.it/b3tkb1
I have some code where I can dynamically add inputs via javascript code. But I'm unable to figure out how to get the data from the input boxes created. How can I get the data back into my python scripts? Do I have to do this with JS?
EDIT: So I found a solution.
In my forms.py I utilize a HiddenField(). Then in my javascript I take my addCount var used in generating the input boxes and store that value into my HiddenField. Then from my routes.py I am able to access the HiddenField data via request.form.get('hiddenNum'). Once I have that value, I can loop over the range to generate the names for each added input box.
Forms:
class SubDirForm(FlaskForm):
subDirName = TextField(validators=[DataRequired()])
class SubDirsForm(FlaskForm):
subDirList = FieldList(FormField(SubDirForm), min_entries=0)
submit = SubmitField(label='Print')
addField = ButtonField(label='Add Field', id='addNewField')
hiddenNum = HiddenField()
Route:
@bp.route('/', methods=['GET', 'POST'])
/r/flask
https://redd.it/b3tkb1
reddit
r/flask - Getting data from dynamically created inputs
0 votes and 0 comments so far on Reddit
[P] I scraped 32,000 cars, including the price and 115 specifications
NEW cars. Specs include MSRP, Gas Mileage, Engine, EPA Class, Style Name, Drivetrain, SAE Net Torque @ RPM, Fuel System, Engine Type, SAE Net Horsepower @ RPM, Displacement, etc. The cars are all cars available on the American market.
Get the CSV (44MB) on my [drive](https://drive.google.com/file/d/1HnpfG2xj_6EZ7Tgle2QB9Yn_YS7r7uVA/view?usp=sharing), or look how I did it on [Github](https://github.com/nicolas-gervais/predicting-car-price-from-scraped-data/blob/master/scraping).
/r/MachineLearning
https://redd.it/b6r34a
NEW cars. Specs include MSRP, Gas Mileage, Engine, EPA Class, Style Name, Drivetrain, SAE Net Torque @ RPM, Fuel System, Engine Type, SAE Net Horsepower @ RPM, Displacement, etc. The cars are all cars available on the American market.
Get the CSV (44MB) on my [drive](https://drive.google.com/file/d/1HnpfG2xj_6EZ7Tgle2QB9Yn_YS7r7uVA/view?usp=sharing), or look how I did it on [Github](https://github.com/nicolas-gervais/predicting-car-price-from-scraped-data/blob/master/scraping).
/r/MachineLearning
https://redd.it/b6r34a
GitHub
predicting-car-price-from-scraped-data/scraping at master · nicolas-gervais/predicting-car-price-from-scraped-data
Picture and specifications scraper. Contribute to nicolas-gervais/predicting-car-price-from-scraped-data development by creating an account on GitHub.
[AF]Tag input form in Flask?
I've been trying to implement what is really just a form where you type a word, hit a comma, and the word is put into a little container with an 'X' next to it, pretty much what you would expect from a form that is looking to separate tags.
Does anyone know the name of what this box is called or point me to a form/library that does this? It has been difficult Googling help for this as I don't seem to be coming on the right name for it.
/r/flask
https://redd.it/b3ss4k
I've been trying to implement what is really just a form where you type a word, hit a comma, and the word is put into a little container with an 'X' next to it, pretty much what you would expect from a form that is looking to separate tags.
Does anyone know the name of what this box is called or point me to a form/library that does this? It has been difficult Googling help for this as I don't seem to be coming on the right name for it.
/r/flask
https://redd.it/b3ss4k
reddit
r/flask - [AF]Tag input form in Flask?
3 votes and 2 comments so far on Reddit
Added Docker support for dev environment
Hi guys,
previously is shared my boilerplate for flask, now i am here with another change that is docker based development environment. I added the docker support for the dev environment.
Here is the link to the repo:
[https://github.com/a-wakeel/flask-bp](https://github.com/a-wakeel/flask-bp)
​
Will appreciate any suggestions and appreciations.
Cheers !
/r/flask
https://redd.it/b3n2i2
Hi guys,
previously is shared my boilerplate for flask, now i am here with another change that is docker based development environment. I added the docker support for the dev environment.
Here is the link to the repo:
[https://github.com/a-wakeel/flask-bp](https://github.com/a-wakeel/flask-bp)
​
Will appreciate any suggestions and appreciations.
Cheers !
/r/flask
https://redd.it/b3n2i2
GitHub
a-wakeel/flask-bp
A comprehensive boilerplate for flask projects. Contribute to a-wakeel/flask-bp development by creating an account on GitHub.
If you were to create only the frontend part of an eCommerce site in 2019, is it a terrible idea to use Django?
I'm looking at using Saleor for the backend of an eCommerce and making use of the GraphQL API to build a "core" backend that can be replicated over a number of shops with the database being the only variable, and a number of frontends for different shops for each of the brands that we sell.
Now I'm not much of a javascript guy (outside of some basic jQuery stuff, the "modern" ES6 syntax makes me feel a little sick) so I really do not understand the Saleor React based [storefront frontend](https://github.com/mirumee/saleor-storefront).
​
So I'm left with a few options:
1. Suck it up and try and learn their complicated React frontend
2. Build a frontend in Django and use that to talk to the backend, use Django templates and a spinkling of jQuery as I have done in the past.
3. Build a new frontend in React or Vue and learn how it all works for myself
​
The requirements any front end would meet would be:
* Any easy to understand templating system, ideally something similar to [Shopify's liquid templates](https://shopify.github.io/liquid/basics/introduction/) or [EKM Tags](https://tags.ekm.com/)
* Full server side rendering, SEO is very important to us
​
I'm not looking to build fancy SPA's or PWA's, just simple, performant shops based on
/r/django
https://redd.it/b6vewm
I'm looking at using Saleor for the backend of an eCommerce and making use of the GraphQL API to build a "core" backend that can be replicated over a number of shops with the database being the only variable, and a number of frontends for different shops for each of the brands that we sell.
Now I'm not much of a javascript guy (outside of some basic jQuery stuff, the "modern" ES6 syntax makes me feel a little sick) so I really do not understand the Saleor React based [storefront frontend](https://github.com/mirumee/saleor-storefront).
​
So I'm left with a few options:
1. Suck it up and try and learn their complicated React frontend
2. Build a frontend in Django and use that to talk to the backend, use Django templates and a spinkling of jQuery as I have done in the past.
3. Build a new frontend in React or Vue and learn how it all works for myself
​
The requirements any front end would meet would be:
* Any easy to understand templating system, ideally something similar to [Shopify's liquid templates](https://shopify.github.io/liquid/basics/introduction/) or [EKM Tags](https://tags.ekm.com/)
* Full server side rendering, SEO is very important to us
​
I'm not looking to build fancy SPA's or PWA's, just simple, performant shops based on
/r/django
https://redd.it/b6vewm
GitHub
GitHub - saleor/saleor-storefront: A GraphQL-powered, NextJs-based, PWA storefront for Saleor. IMPORTANT: This project is [DEPRECATED]…
A GraphQL-powered, NextJs-based, PWA storefront for Saleor. IMPORTANT: This project is [DEPRECATED] in favor of saleor/react-storefront soon to become our default demo and storefront starter pack. ...
I used the Spotify lyrics script uploaded here last week to create a Telegram bot. It sends you the lyrics of the song you're currently listening, so you can get them on the go! Running as Chatot bot (@Spoti_lyrics_bot) on Telegram.
[https://github.com/manuhortet/spotify-lyrics-bot](https://github.com/manuhortet/spotify-lyrics-bot)
/r/Python
https://redd.it/b6vx0i
[https://github.com/manuhortet/spotify-lyrics-bot](https://github.com/manuhortet/spotify-lyrics-bot)
/r/Python
https://redd.it/b6vx0i
GitHub
manuhortet/spotify-lyrics-bot
Telegram bot to get the lyrics of what you are listening to on Spotify. - manuhortet/spotify-lyrics-bot
Nullable PositiveIntegerField to non-nullable CharField with default w/ Postgres
I am having an issue with my migrations. I am trying to change nullable PositiveIntegerField into non-nullable CharField with a default value. Said migration works like a charm if I don't have any null values in the db, it crashes however with `django.db.utils.OperationalError: cannot ALTER TABLE because it has pending trigger events` error when it encounters a null. I have a workaround that first changes the int field to nullable char field and maps null values to empty string. I would then make yet another migration that would make the field not-nullable. However, I would like to do it all in a single migration. Any ideas or suggestions?
/r/django
https://redd.it/b6yu2l
I am having an issue with my migrations. I am trying to change nullable PositiveIntegerField into non-nullable CharField with a default value. Said migration works like a charm if I don't have any null values in the db, it crashes however with `django.db.utils.OperationalError: cannot ALTER TABLE because it has pending trigger events` error when it encounters a null. I have a workaround that first changes the int field to nullable char field and maps null values to empty string. I would then make yet another migration that would make the field not-nullable. However, I would like to do it all in a single migration. Any ideas or suggestions?
/r/django
https://redd.it/b6yu2l
reddit
r/django - Nullable PositiveIntegerField to non-nullable CharField with default w/ Postgres
0 votes and 3 comments so far on Reddit
My largest python program that i wrote after learning python. It's nothing much compared to what you guys post here.
/r/Python
https://redd.it/b6yegi
/r/Python
https://redd.it/b6yegi
Flask-login + Redis
Hi Everyone,
I'm developing my first flask app. I'm already using Redis for some other function and I'm now trying to add some security via user logins.
I'm wondering if its possible and if its safe to use Redis to manage my users for Flask Login
​
Thank you!
/r/flask
https://redd.it/b6yf7o
Hi Everyone,
I'm developing my first flask app. I'm already using Redis for some other function and I'm now trying to add some security via user logins.
I'm wondering if its possible and if its safe to use Redis to manage my users for Flask Login
​
Thank you!
/r/flask
https://redd.it/b6yf7o
reddit
r/flask - Flask-login + Redis
6 votes and 2 comments so far on Reddit
Open Redirect Vulnerability in Jupyter, JupyterHub
https://blog.jupyter.org/open-redirect-vulnerability-in-jupyter-jupyterhub-adf43583f1e4
/r/IPython
https://redd.it/b6yss8
https://blog.jupyter.org/open-redirect-vulnerability-in-jupyter-jupyterhub-adf43583f1e4
/r/IPython
https://redd.it/b6yss8
Medium
Open Redirect Vulnerability in Jupyter notebook, JupyterHub
JupyterHub ≤ 0.9.4 and Notebook ≤ 5.7.6 are affected. Versions 0.9.5 and 5.7.7 are released today with fixes. Upgrade with pip or conda:
We're a Django shop that produces a podcast about developer culture. This week we talked a lot about eCommerce frameworks for Django!
https://fridayafternoondeploy.simplecast.com/episodes/ecommerce-application-monitoring-and-da-xG6NxpC9
/r/django
https://redd.it/b70fax
https://fridayafternoondeploy.simplecast.com/episodes/ecommerce-application-monitoring-and-da-xG6NxpC9
/r/django
https://redd.it/b70fax
Friday Afternoon Deploy: A Developer Podcast
eCommerce, Application Monitoring, and Dashboards | Friday Afternoon Deploy: A Developer Podcast
Casey and Alan chat about the stuff they've been hacking on this week which includes eCommerce software, application monitoring tools and dashboard frameworks.
My best Python app - written in 2004 - An image editor and e-commerce app
https://imgur.com/gallery/N6skqdz
/r/Python
https://redd.it/b74x4z
https://imgur.com/gallery/N6skqdz
/r/Python
https://redd.it/b74x4z
Imgur
An image editor and e-commerce app written in Python
Post with 4 votes and 105 views. Shared by dogsnogger. An image editor and e-commerce app written in Python
Using JSONField to extend models in an asset inventory - good idea?
(Originally posted in /r/djangolearning but didn't get much traction. Hoping to get more input/ideas/best practices)
I'm building an asset management system as part of a larger project. I want to allow end users to add additional fields for assets.
I have three levels of models that help to organize and describe assets: AssetType in the most generic, then Asset, and finally the individual AssetInstance - the record for a single item.
Here are some stripped down model definitions:
class AssetType(models.Model):
'''
Very broad model used to create a hierarchical categorization of assets. For instance, "Vehicle"
'''
asset_type = ForeignKey(AssetType, ) # Asset Types can belong under other Asset Types
title = models.CharField(max_length=100)
additional_fields = models.JSONField() # Additional fields and parameters to be added to all AssetInstances of this AssetType
class Asset(models.Model):
'''
More specific . For instance, "Truck" with
/r/django
https://redd.it/b759rf
(Originally posted in /r/djangolearning but didn't get much traction. Hoping to get more input/ideas/best practices)
I'm building an asset management system as part of a larger project. I want to allow end users to add additional fields for assets.
I have three levels of models that help to organize and describe assets: AssetType in the most generic, then Asset, and finally the individual AssetInstance - the record for a single item.
Here are some stripped down model definitions:
class AssetType(models.Model):
'''
Very broad model used to create a hierarchical categorization of assets. For instance, "Vehicle"
'''
asset_type = ForeignKey(AssetType, ) # Asset Types can belong under other Asset Types
title = models.CharField(max_length=100)
additional_fields = models.JSONField() # Additional fields and parameters to be added to all AssetInstances of this AssetType
class Asset(models.Model):
'''
More specific . For instance, "Truck" with
/r/django
https://redd.it/b759rf
reddit
r/django - Using JSONField to extend models in an asset inventory - good idea?
2 votes and 0 comments so far on Reddit
What is the biggest blunder you made due to dynamically typed nature of Python? Have you started using mypy extensively yet?
https://www.reddit.com/r/learnpython/comments/b76ad2/what_is_the_biggest_blunder_you_made_due_to/
/r/Python
https://redd.it/b76apk
https://www.reddit.com/r/learnpython/comments/b76ad2/what_is_the_biggest_blunder_you_made_due_to/
/r/Python
https://redd.it/b76apk
reddit
r/learnpython - What is the biggest blunder you made due to dynamically typed nature of Python? Have you started using mypy extensively…
1 vote and 6 comments so far on Reddit