We're doing a free webinar today: Different Auth mechanisms in RESTful APIs (using Flask). In case anyone is interested.
https://zoom.us/webinar/register/611b49b81e5a706166858a512be5123a
/r/Python
https://redd.it/6c5t82
https://zoom.us/webinar/register/611b49b81e5a706166858a512be5123a
/r/Python
https://redd.it/6c5t82
Zoom Video
Welcome! You are invited to join a webinar: FREE Flask Class - Authentication in RESTful APIs. After registering, you will receive…
Check our FREE Flask Tutorial if you haven't already: https://flask-tutorial.com
******************************************************************
The class will be online and LIVE. That means you'll be able to ask questions and talk with the instructor…
******************************************************************
The class will be online and LIVE. That means you'll be able to ask questions and talk with the instructor…
can (or should) ipython or Jupyter console be able to edit a class?
Hello. I am using ipython3, and also trying with jupyter console and have not found a way to %edit a class that I enter in.
If I enter in something like:
class Parent(object):
def test(self):
print("testing")
I do not get any errors and can call and use objects of that type. But I am not able to %edit that class. For example, I get:
/usr/local/lib/python3.6/site-packages/IPython/core/magics/code.py:503: UserWarning: The file where `<class '__main__.Parent'>` was defined cannot be read or found.
'cannot be read or found.' % data)
But if I enter a function, like 'def testit():', then I can %edit testit as I would expect.
Is there something I am not entering to distinguish the class I am trying to edit?
Thanks!
/r/IPython
https://redd.it/6c7vhh
Hello. I am using ipython3, and also trying with jupyter console and have not found a way to %edit a class that I enter in.
If I enter in something like:
class Parent(object):
def test(self):
print("testing")
I do not get any errors and can call and use objects of that type. But I am not able to %edit that class. For example, I get:
/usr/local/lib/python3.6/site-packages/IPython/core/magics/code.py:503: UserWarning: The file where `<class '__main__.Parent'>` was defined cannot be read or found.
'cannot be read or found.' % data)
But if I enter a function, like 'def testit():', then I can %edit testit as I would expect.
Is there something I am not entering to distinguish the class I am trying to edit?
Thanks!
/r/IPython
https://redd.it/6c7vhh
reddit
can (or should) ipython or Jupyter console be able to... • r/IPython
Hello. I am using ipython3, and also trying with jupyter console and have not found a way to %edit a class that I enter in. If I enter in...
Make your own music with WaveNets
https://magenta.tensorflow.org/nsynth-instrument
/r/MachineLearning
https://redd.it/6c4g5k
https://magenta.tensorflow.org/nsynth-instrument
/r/MachineLearning
https://redd.it/6c4g5k
Magenta
Making a Neural Synthesizer Instrument
In a previous post, we described the details of NSynth (Neural Audio Synthesis), a new approach to audio synthesis using neural networks. We hinted at furthe...
We're doing a free webinar today: Different Auth mechanisms in RESTful APIs (using Flask). In case anyone is interested.
https://zoom.us/webinar/register/611b49b81e5a706166858a512be5123a
/r/flask
https://redd.it/6c6qo5
https://zoom.us/webinar/register/611b49b81e5a706166858a512be5123a
/r/flask
https://redd.it/6c6qo5
Zoom Video
Welcome! You are invited to join a webinar: FREE Flask Class - Authentication in RESTful APIs. After registering, you will receive…
Check our FREE Flask Tutorial if you haven't already: https://flask-tutorial.com
******************************************************************
The class will be online and LIVE. That means you'll be able to ask questions and talk with the instructor…
******************************************************************
The class will be online and LIVE. That means you'll be able to ask questions and talk with the instructor…
PyCon 2017 videos
Just a heads up to those who were unaware, pycon 2017 has begun uploading talks to youtube.
https://www.youtube.com/channel/UCrJhliKNQ8g0qoE_zvL8eVg/videos
/r/Python
https://redd.it/6c810y
Just a heads up to those who were unaware, pycon 2017 has begun uploading talks to youtube.
https://www.youtube.com/channel/UCrJhliKNQ8g0qoE_zvL8eVg/videos
/r/Python
https://redd.it/6c810y
YouTube
PyCon 2017
PyCon 2017 Conference tutorials and talks (https://us.pycon.org/2017/).
Upload and process a remote file called by an API REST call with a Django backend
The application is written in Django. I need to A) upload a file (an Excel spreadsheet) from a remote location (it could be via HTTP or SFTP), headless, i.e. without a form--could it be a call to an external process?, B) triggered by a signal/API call issued by a remote client. The file will then be processed (it could be synchronously or asynchronously) to update a database in the backend (this latter part is already working and is implemented with a file which is read locally). What is the best strategy/architecture, and tools (packages, commands, etc.) to use to solve both points A) and B) above?
/r/django
https://redd.it/6c9za7
The application is written in Django. I need to A) upload a file (an Excel spreadsheet) from a remote location (it could be via HTTP or SFTP), headless, i.e. without a form--could it be a call to an external process?, B) triggered by a signal/API call issued by a remote client. The file will then be processed (it could be synchronously or asynchronously) to update a database in the backend (this latter part is already working and is implemented with a file which is read locally). What is the best strategy/architecture, and tools (packages, commands, etc.) to use to solve both points A) and B) above?
/r/django
https://redd.it/6c9za7
reddit
Upload and process a remote file called by an API REST... • r/django
The application is written in Django. I need to A) upload a file (an Excel spreadsheet) from a remote location (it could be via HTTP or SFTP),...
Help with differentiating types of users
Hello everyone, I'm a bit confused as to how about I can solve this problem.
I have two types of users: parent and child.
Parent users can CRUD objects, and child users can only view.
What is the best way to create a login system so that creating a user can choose between one of these types and that upon login they are directed the their view of their respective user?
Should I just make a User class with a boolean attribute as Parent=true/false?
/r/flask
https://redd.it/6by6zv
Hello everyone, I'm a bit confused as to how about I can solve this problem.
I have two types of users: parent and child.
Parent users can CRUD objects, and child users can only view.
What is the best way to create a login system so that creating a user can choose between one of these types and that upon login they are directed the their view of their respective user?
Should I just make a User class with a boolean attribute as Parent=true/false?
/r/flask
https://redd.it/6by6zv
reddit
Help with differentiating types of users • r/flask
Hello everyone, I'm a bit confused as to how about I can solve this problem. I have two types of users: parent and child. Parent users can CRUD...
Unique Form Urls to update Model Instances
I have a model with a project number field and notes field. I would like to generate a URL for each project number, and on that page have a form field that would allow me to update that note. Any ideas?
I'm getting a name error in my view that "request" is not defined.
Here's what I have so far...
Model:
class Projectsummary(models.Model):
number = models.CharField(db_column='Number', primary_key=True, max_length=50) # Field name made lowercase.
projectnote = models.TextField(db_column='ProjectNote', blank=True, null=True)
overrunnote = models.TextField(db_column='OverrunNote', blank=True, null=True)
View:
def inputs(requset, number):
formnumber = Projectsummary.objects.get(number=number)
form = ProjNoteField(request.POST or None, instance=formnumber)
if form.is_valid():
form.save()
return HttpResponseRedirect('app/pmhub/')
context = {'form': form}
return render(requset, 'projectinputfields.html', context)
Forms:
class ProjNoteField(forms.ModelForm):
class Meta:
model = Projectsummary
fields = ['projectnote', 'overrunnote']
/r/django
https://redd.it/6cc5vp
I have a model with a project number field and notes field. I would like to generate a URL for each project number, and on that page have a form field that would allow me to update that note. Any ideas?
I'm getting a name error in my view that "request" is not defined.
Here's what I have so far...
Model:
class Projectsummary(models.Model):
number = models.CharField(db_column='Number', primary_key=True, max_length=50) # Field name made lowercase.
projectnote = models.TextField(db_column='ProjectNote', blank=True, null=True)
overrunnote = models.TextField(db_column='OverrunNote', blank=True, null=True)
View:
def inputs(requset, number):
formnumber = Projectsummary.objects.get(number=number)
form = ProjNoteField(request.POST or None, instance=formnumber)
if form.is_valid():
form.save()
return HttpResponseRedirect('app/pmhub/')
context = {'form': form}
return render(requset, 'projectinputfields.html', context)
Forms:
class ProjNoteField(forms.ModelForm):
class Meta:
model = Projectsummary
fields = ['projectnote', 'overrunnote']
/r/django
https://redd.it/6cc5vp
reddit
Unique Form Urls to update Model Instances • r/django
I have a model with a project number field and notes field. I would like to generate a URL for each project number, and on that page have a form...
Introduction to web scraping with Python
https://datawhatnow.com/introduction-web-scraping-python/
/r/Python
https://redd.it/6cas7x
https://datawhatnow.com/introduction-web-scraping-python/
/r/Python
https://redd.it/6cas7x
Data, what now?
Introduction to web scraping with Python - Data, what now?
Data is the core of predictive modeling, visualization, and analytics. Unfortunately, the needed data is not always readily available to the user, it is most often unstructured. The biggest source of data is the Internet, and with programming, we can extract…
Raymond Hettinger: Modern Python Dictionaries: A confluence of a dozen great ideas (PyCon 2017)
https://www.youtube.com/watch?v=npw4s1QTmPg
/r/Python
https://redd.it/6cd9oo
https://www.youtube.com/watch?v=npw4s1QTmPg
/r/Python
https://redd.it/6cd9oo
YouTube
Raymond Hettinger Modern Python Dictionaries A confluence of a dozen great ideas PyCon 2017
"Speaker: Raymond Hettinger
Python's dictionaries are stunningly good. Over the years,
many great ideas have combined together to produce the
modern implementation in Python 3.6.
This fun talk uses pictures and little bits of pure python
code to explain…
Python's dictionaries are stunningly good. Over the years,
many great ideas have combined together to produce the
modern implementation in Python 3.6.
This fun talk uses pictures and little bits of pure python
code to explain…
Passing variables within functions
Hello everyone,
I have few function which look something like this:
@login_required
def get_pages(request, startDate='2017-01-01', endDate='today'):
do_something..
@login_required
def get_speed(request, startDate='2017-01-01', endDate='today'):
do_something..
etc..
These functions get the data for the correct period and save it in my db. Now I want a new function which calls them changing the startDate & endDate parameter, so I can update metrics daily.
I tried something like this:
def update_last2days(requests):
get_speed('yesterday','today') # The API accepts yesterday & today as input format. Consider it as YYYY-MM-DD
get_pages('yesterday','today')
return redirect('/report?updated=true')
I also tried:
def update_last2days(requests):
get_speed(request, 'yesterday','today')
get_pages(request, 'yesterday','today')
return redirect('/report?updated=true')
But I keep getting `'str' object has no attribute 'user'` and I can't figure out why. How can I call a function with new parameters?
P.s. when I add the values `today` and `yesterday` to the main function all works just fine.
/r/django
https://redd.it/6ccwy3
Hello everyone,
I have few function which look something like this:
@login_required
def get_pages(request, startDate='2017-01-01', endDate='today'):
do_something..
@login_required
def get_speed(request, startDate='2017-01-01', endDate='today'):
do_something..
etc..
These functions get the data for the correct period and save it in my db. Now I want a new function which calls them changing the startDate & endDate parameter, so I can update metrics daily.
I tried something like this:
def update_last2days(requests):
get_speed('yesterday','today') # The API accepts yesterday & today as input format. Consider it as YYYY-MM-DD
get_pages('yesterday','today')
return redirect('/report?updated=true')
I also tried:
def update_last2days(requests):
get_speed(request, 'yesterday','today')
get_pages(request, 'yesterday','today')
return redirect('/report?updated=true')
But I keep getting `'str' object has no attribute 'user'` and I can't figure out why. How can I call a function with new parameters?
P.s. when I add the values `today` and `yesterday` to the main function all works just fine.
/r/django
https://redd.it/6ccwy3
reddit
Passing variables within functions • r/django
Hello everyone, I have few function which look something like this: @login_required def get_pages(request, startDate='2017-01-01',...
Porting a program I wrote in python to be a web app. Have questions about how to structure data files.
Okay, so I recently learned python so that I could write a drop logging program for an MMO that I play. It might be sloppy (I don't know, this is my first coding project ever), but all of the features I initially envisioned function properly and I want other people to be able to use it now. Initially I was going to package it into an .exe and distribute that, but after some research and thinking on it for a bit, I've decided it makes more sense and will be better in the long run to make a web app with the same functionality for users to access.
My question is, my drop logger utilizes text files to pull drop table data for monsters from as well as save drop logs to. (I.e. a text file named "monster name droptable.txt" with a tab separated column/row structure for the items it can drop like item name, item quantity, etc...).
Drop logs that users create are also saved and loaded from txt files. I've gone through a few tutorials and it seems Flask would be perfect for making a simple web app that functions the same as my program. But, after looking into databases, I'm not sure how to store my data for retrieval. Is it still okay/efficient to just have static text files on the server and if I want to edit a drop table for a monster, or add a new monster, I can just edit/add a text file? Or should I store this information in a database. I feel like each monster would need it's own database, so is there a limit/problem with having a ton of databases?
As for user saved files. If a user wants to save a drop log to load at a later time, (or download to their computer) I knew I'd have to use a database to store this data (at least a filepath to their specific text drop log file), but should I store the drop logs themselves in databases?
Sorry if these are newbie questions, I'm just ready to jump into this and rebuild my program as a web app, but I don't even know which tutorials I need to be looking at because I don't know what's best. I don't want to do it one way only to find out a few days/weeks from now that it was a bad decision and backtrack to square one.
Thank you for any help!
/r/flask
https://redd.it/6ccncc
Okay, so I recently learned python so that I could write a drop logging program for an MMO that I play. It might be sloppy (I don't know, this is my first coding project ever), but all of the features I initially envisioned function properly and I want other people to be able to use it now. Initially I was going to package it into an .exe and distribute that, but after some research and thinking on it for a bit, I've decided it makes more sense and will be better in the long run to make a web app with the same functionality for users to access.
My question is, my drop logger utilizes text files to pull drop table data for monsters from as well as save drop logs to. (I.e. a text file named "monster name droptable.txt" with a tab separated column/row structure for the items it can drop like item name, item quantity, etc...).
Drop logs that users create are also saved and loaded from txt files. I've gone through a few tutorials and it seems Flask would be perfect for making a simple web app that functions the same as my program. But, after looking into databases, I'm not sure how to store my data for retrieval. Is it still okay/efficient to just have static text files on the server and if I want to edit a drop table for a monster, or add a new monster, I can just edit/add a text file? Or should I store this information in a database. I feel like each monster would need it's own database, so is there a limit/problem with having a ton of databases?
As for user saved files. If a user wants to save a drop log to load at a later time, (or download to their computer) I knew I'd have to use a database to store this data (at least a filepath to their specific text drop log file), but should I store the drop logs themselves in databases?
Sorry if these are newbie questions, I'm just ready to jump into this and rebuild my program as a web app, but I don't even know which tutorials I need to be looking at because I don't know what's best. I don't want to do it one way only to find out a few days/weeks from now that it was a bad decision and backtrack to square one.
Thank you for any help!
/r/flask
https://redd.it/6ccncc
reddit
Porting a program I wrote in python to be a web app.... • r/flask
Okay, so I recently learned python so that I could write a drop logging program for an MMO that I play. It might be sloppy (I don't know, this is...
Anyone tried using Brython in Flask/Python apps? What were your thoughts?
[Brython](http://brython.info/) is a Python-to-JavaScript tool, for anyone unaware.
/r/flask
https://redd.it/6br4vb
[Brython](http://brython.info/) is a Python-to-JavaScript tool, for anyone unaware.
/r/flask
https://redd.it/6br4vb
Building a potential botnet on PyPi
https://hackernoon.com/building-a-botnet-on-pypi-be1ad280b8d6
/r/Python
https://redd.it/6cbvvk
https://hackernoon.com/building-a-botnet-on-pypi-be1ad280b8d6
/r/Python
https://redd.it/6cbvvk
Hacker Noon
Building a botnet on PyPi
Or being able to
Logging number of requests to a rest api
Hi Reddit, I am working on tracking the number of times our rest api endpoints are called over time. What are some best practices for doing this?
I'm thinking I could write some python to update a JSON file each time the API is called, however this API is called thousands of times a day and am afraid this might be way to expensive of a process to launch each time it's called.
Any help is appreciated!
/r/flask
https://redd.it/6bqf4e
Hi Reddit, I am working on tracking the number of times our rest api endpoints are called over time. What are some best practices for doing this?
I'm thinking I could write some python to update a JSON file each time the API is called, however this API is called thousands of times a day and am afraid this might be way to expensive of a process to launch each time it's called.
Any help is appreciated!
/r/flask
https://redd.it/6bqf4e
reddit
Logging number of requests to a rest api • r/flask
Hi Reddit, I am working on tracking the number of times our rest api endpoints are called over time. What are some best practices for doing this?...
Question: How to verify that a user is posting (POST) to a flask webapp only using my CLI?
I am building an application which send POST request to an endpoint. I want to block the user from manually posting the POST request using some tools. I want to make sure that the user is posting to the flask webapp from my python script. What is the best way to implement this?
/r/Python
https://redd.it/6cfi2i
I am building an application which send POST request to an endpoint. I want to block the user from manually posting the POST request using some tools. I want to make sure that the user is posting to the flask webapp from my python script. What is the best way to implement this?
/r/Python
https://redd.it/6cfi2i
reddit
Question: How to verify that a user is posting (POST)... • r/Python
I am building an application which send POST request to an endpoint. I want to block the user from manually posting the POST request using some...
Kalliope v0.4.4 is out !
Kalliope is a modular always-on voice controlled personal assistant designed for home automation.
This new release brings new features, fixes many bugs and new plugins (called neurons !).
You can check details, videos and the neuron market place on the github page : https://kalliope-project.github.io/
The target is a rasp3 on raspbian, but you can quickly test it on a Ubuntu. You just need a microphone and a speaker/heapphones.
Python 2.7, 3.4, 3.5 and 3.6 are supported.
The project is open source under the MIT licence.
Find sources on github : https://github.com/kalliope-project/kalliope
Here is the changelog for the v0.4.4:
- Fix: Uppercase in order/parameters/global variables are now handled correctly
- Fix: usage of integer in neuron parameters
- Fix: encoding with special character
- Refactor main controller. Use a LIFO to allow full usage of kalliope via API (even with neurotransmitter)
- Add a systemd script to start kalliope automatically
docker testing
- python 3 support 3.4, 3.5, 3.6
- Increase testing code coverage
- Fix: Raspberry performance. CPU usage from 120% to 15%
- Input value refactoring. "args" parameter replaced by jinja templating
- Review TTS overriding config in neuron declaration
- Fix: accapela TTS
- LED and mute button support for Raspberry Pi
- Player modularity
Enjoy !
/r/Python
https://redd.it/6cgwic
Kalliope is a modular always-on voice controlled personal assistant designed for home automation.
This new release brings new features, fixes many bugs and new plugins (called neurons !).
You can check details, videos and the neuron market place on the github page : https://kalliope-project.github.io/
The target is a rasp3 on raspbian, but you can quickly test it on a Ubuntu. You just need a microphone and a speaker/heapphones.
Python 2.7, 3.4, 3.5 and 3.6 are supported.
The project is open source under the MIT licence.
Find sources on github : https://github.com/kalliope-project/kalliope
Here is the changelog for the v0.4.4:
- Fix: Uppercase in order/parameters/global variables are now handled correctly
- Fix: usage of integer in neuron parameters
- Fix: encoding with special character
- Refactor main controller. Use a LIFO to allow full usage of kalliope via API (even with neurotransmitter)
- Add a systemd script to start kalliope automatically
docker testing
- python 3 support 3.4, 3.5, 3.6
- Increase testing code coverage
- Fix: Raspberry performance. CPU usage from 120% to 15%
- Input value refactoring. "args" parameter replaced by jinja templating
- Review TTS overriding config in neuron declaration
- Fix: accapela TTS
- LED and mute button support for Raspberry Pi
- Player modularity
Enjoy !
/r/Python
https://redd.it/6cgwic
GitHub
GitHub - kalliope-project/kalliope: Kalliope is a framework that will help you to create your own personal assistant.
Kalliope is a framework that will help you to create your own personal assistant. - kalliope-project/kalliope
I'm having problems with Django/nginx/uwsgi and uploading files larger than ~4MB
So, I don't know if this is the correct location to ask these questions, but I'm, well, kinda hopeless now. I've read through halve the internet for weeks without any luck.
I'm *very new* to hosting Django applications (or actually, I'm new to hosting and Linux in general too) so maybe I keep doing something stupid. Anyway, the problem:
I'm working on a (personal) Django website. In the Django admin, there's a page where you can upload multiple images and a optional pdf. So far so good. It works flawlessly on my local machine. However, when I run this on the server, things get weird.
When the *total* request size is smaller than ~4MB (e.g. 1 pdf of 2MB, or 4 images of 700KB etc.) everything works fine. When the request size is larger, the files get saved on the server without a single problem. **But**, they then become inaccessible and I get nginx 403 errors on those files. The Linux permissions are actually different. A 'good' file gets 664 as permissions, a 'bad' file only has 600.
I'm having this problem for weeks now and I'm so frustrated now. To the point that I'm just getting demotivated to even work on it. I've tried so many things, even completely resetting the whole server multiple times, but this stupid ass problem just keeps re-appearing. If *anyone* has the solution or the golden tip, I'd be sooo grateful.
Thanks for reading! :)
-----------
Running on a Linode server with:
Ubuntu 17.04, Python 3, Django 1.11, Nginx, Uwsgi
/r/django
https://redd.it/6cfg3c
So, I don't know if this is the correct location to ask these questions, but I'm, well, kinda hopeless now. I've read through halve the internet for weeks without any luck.
I'm *very new* to hosting Django applications (or actually, I'm new to hosting and Linux in general too) so maybe I keep doing something stupid. Anyway, the problem:
I'm working on a (personal) Django website. In the Django admin, there's a page where you can upload multiple images and a optional pdf. So far so good. It works flawlessly on my local machine. However, when I run this on the server, things get weird.
When the *total* request size is smaller than ~4MB (e.g. 1 pdf of 2MB, or 4 images of 700KB etc.) everything works fine. When the request size is larger, the files get saved on the server without a single problem. **But**, they then become inaccessible and I get nginx 403 errors on those files. The Linux permissions are actually different. A 'good' file gets 664 as permissions, a 'bad' file only has 600.
I'm having this problem for weeks now and I'm so frustrated now. To the point that I'm just getting demotivated to even work on it. I've tried so many things, even completely resetting the whole server multiple times, but this stupid ass problem just keeps re-appearing. If *anyone* has the solution or the golden tip, I'd be sooo grateful.
Thanks for reading! :)
-----------
Running on a Linode server with:
Ubuntu 17.04, Python 3, Django 1.11, Nginx, Uwsgi
/r/django
https://redd.it/6cfg3c
reddit
I'm having problems with Django/nginx/uwsgi and... • r/django
So, I don't know if this is the correct location to ask these questions, but I'm, well, kinda hopeless now. I've read through halve the internet...