Best way to test Django REST API with Authentication?
I've successfully built a Django REST API with a few preliminary endpoints. They work fine and I can test them in a browser or with 'curl' in Terminal.
However, now I'd like to implement Authentication. Once Authentication is in place, is using something like Postman the only way to test the endpoints?
Currently reading this: http://www.django-rest-framework.org/api-guide/authentication/ Which Authentication approach have you used for your REST APIs? Session? Token? Something else?
Robert
/r/django
https://redd.it/69ztz0
I've successfully built a Django REST API with a few preliminary endpoints. They work fine and I can test them in a browser or with 'curl' in Terminal.
However, now I'd like to implement Authentication. Once Authentication is in place, is using something like Postman the only way to test the endpoints?
Currently reading this: http://www.django-rest-framework.org/api-guide/authentication/ Which Authentication approach have you used for your REST APIs? Session? Token? Something else?
Robert
/r/django
https://redd.it/69ztz0
www.django-rest-framework.org
Authentication - Django REST framework
Django, API, REST, Authentication
Not understanding field__icontains?
I'm having a problem implementing a database query using a string.
I've tried many different methods with all of the same results, and am nowhere closer to the goal.
#urls.py
url(r'^api/v1/item/nomen/contains/(?P<nomen>[\w\-]+)/$', views.ItemListContainsNomen.as_view(), name='item_lookup_contains_nomen'),
#views.py
class ItemListContainsNomen(generics.ListAPIView):
serializer_class = ItemSerializer
def get_queryset(self):
nomen = self.kwargs['nomen']
return Item.objects.filter(nomenclature__icontains=nomen)
class Item(models.Model):
id = models.IntegerField(primary_key=True)
nomenclature = models.CharField(max_length=35)
This nets me a warning such as
> "/.virtualenvs/realDjango/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py:110: Warning: Truncated incorrect DOUBLE value: 'nomen/contains/CLOSER'
>
> return self.cursor.execute(query, args)
>
> Not Found: /api/v1/item/nomen/contains/CLOSER/"
I can successfully run this query using the MYSQL console and raw MYSQL with LIKE, and I can successfully query another database's TextField using the same syntax in Django.....but this column just doesn't seem to work no matter what. There has to be something I'm missing. I should also note, replacing icontains=nomen with say, icontains="CLOSER" also yields the same errors.
Checking datatype in console shows
> +-----------+
> | DATA_TYPE |
> +-----------+
> | varchar |
> +-----------+
> 1 row in set (1.39 sec)
/r/django
https://redd.it/6a0tz9
I'm having a problem implementing a database query using a string.
I've tried many different methods with all of the same results, and am nowhere closer to the goal.
#urls.py
url(r'^api/v1/item/nomen/contains/(?P<nomen>[\w\-]+)/$', views.ItemListContainsNomen.as_view(), name='item_lookup_contains_nomen'),
#views.py
class ItemListContainsNomen(generics.ListAPIView):
serializer_class = ItemSerializer
def get_queryset(self):
nomen = self.kwargs['nomen']
return Item.objects.filter(nomenclature__icontains=nomen)
class Item(models.Model):
id = models.IntegerField(primary_key=True)
nomenclature = models.CharField(max_length=35)
This nets me a warning such as
> "/.virtualenvs/realDjango/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py:110: Warning: Truncated incorrect DOUBLE value: 'nomen/contains/CLOSER'
>
> return self.cursor.execute(query, args)
>
> Not Found: /api/v1/item/nomen/contains/CLOSER/"
I can successfully run this query using the MYSQL console and raw MYSQL with LIKE, and I can successfully query another database's TextField using the same syntax in Django.....but this column just doesn't seem to work no matter what. There has to be something I'm missing. I should also note, replacing icontains=nomen with say, icontains="CLOSER" also yields the same errors.
Checking datatype in console shows
> +-----------+
> | DATA_TYPE |
> +-----------+
> | varchar |
> +-----------+
> 1 row in set (1.39 sec)
/r/django
https://redd.it/6a0tz9
reddit
Not understanding field__icontains? • r/django
I'm having a problem implementing a database query using a string. I've tried many different methods with all of the same results, and am nowhere...
Anyone familiar with Django deployment with AWS?
I am able to deploy my django app to AWS with no issues with Nginx and Gunicorn. My site functions properly at the public IP. Now I'm trying to point my domain name to the AWS instance.
I followed the instructions [here](https://u.osu.edu/walujo.1/2016/07/07/associate-namecheap-domain-to-amazon-ec2-instance/) and I can't even access the elastic IP (Bad Request 400 error). AWS is configured properly to allow incoming HTTP/S requests.
I'm willing to pay for someone to help me get this resolved, if anyone was so inclined. I'm brand new to deployment and can't wrap my head around what's going wrong.
/r/djangolearning
https://redd.it/69sk3x
I am able to deploy my django app to AWS with no issues with Nginx and Gunicorn. My site functions properly at the public IP. Now I'm trying to point my domain name to the AWS instance.
I followed the instructions [here](https://u.osu.edu/walujo.1/2016/07/07/associate-namecheap-domain-to-amazon-ec2-instance/) and I can't even access the elastic IP (Bad Request 400 error). AWS is configured properly to allow incoming HTTP/S requests.
I'm willing to pay for someone to help me get this resolved, if anyone was so inclined. I'm brand new to deployment and can't wrap my head around what's going wrong.
/r/djangolearning
https://redd.it/69sk3x
How to read a csv file with multiple header rows into pandas?
https://github.com/Tresanne/IS362-JUPYTERNOTEBOOK/blob/master/Impact_Poverty-%20fixed.csv
I am not sure how to read the multiple rows. Do i have to do it without the rows and then do it manually in pandas? Or is there a way to read the whole csv file into pandas?
/r/IPython
https://redd.it/69zaw3
https://github.com/Tresanne/IS362-JUPYTERNOTEBOOK/blob/master/Impact_Poverty-%20fixed.csv
I am not sure how to read the multiple rows. Do i have to do it without the rows and then do it manually in pandas? Or is there a way to read the whole csv file into pandas?
/r/IPython
https://redd.it/69zaw3
GitHub
Tresanne/IS362-JUPYTERNOTEBOOK
Contribute to IS362-JUPYTERNOTEBOOK development by creating an account on GitHub.
Override save and DjangoAdmin
I have a custom User model where I overrode the save() method with one that assigns the user to appropriate UserGroups based on a field. However, based on [this](http://stackoverflow.com/questions/1925383/issue-with-manytomany-relationships-not-updating-inmediatly-after-save), it seems that DjangoAdmin will ignore any changes I make to an M2M field. What are my options to solve this?
/r/djangolearning
https://redd.it/69p9ki
I have a custom User model where I overrode the save() method with one that assigns the user to appropriate UserGroups based on a field. However, based on [this](http://stackoverflow.com/questions/1925383/issue-with-manytomany-relationships-not-updating-inmediatly-after-save), it seems that DjangoAdmin will ignore any changes I make to an M2M field. What are my options to solve this?
/r/djangolearning
https://redd.it/69p9ki
Stackoverflow
Issue with ManyToMany Relationships not updating inmediatly after save
I'm having issues with ManytoMany Relationships that are not updating
in a model when I save it (via the admin) and try to use the new value within a
function attached to the post_save signal or wi...
in a model when I save it (via the admin) and try to use the new value within a
function attached to the post_save signal or wi...
[AF] Flask serving up static files as variables
I'm having a very strange issue. I provide an URL for users to access their personal reports (http://subdomain.domain.net/<input_str>) and when I test it it works just fine, but in production the MSISDN variable is always a static file from the app directory. Has anybody encountered an issue like this before?
[Tue May 09 00:28:48.398973 2017] [wsgi:error] [pid 30477:tid 140308822042368] User MSISDN is: apple-touch-icon.png
[Tue May 09 00:35:30.320477 2017] [wsgi:error] [pid 30740:tid 140308922754816] User MSISDN is: license.txt
[Tue May 09 00:35:30.332013 2017] [wsgi:error] [pid 30740:tid 140308914362112] User MSISDN is: rss
[Tue May 09 00:35:30.336705 2017] [wsgi:error] [pid 30740:tid 140308889184000] User MSISDN is: robots.txt
[Tue May 09 00:35:30.337023 2017] [wsgi:error] [pid 30740:tid 140308905969408] User MSISDN is: sitemap.xml
[Tue May 09 01:11:56.253829 2017] [wsgi:error] [pid 32139:tid 140308830435072] User MSISDN is: 254799369284
[Tue May 09 01:14:11.350096 2017] [wsgi:error] [pid 32074:tid 140308763293440] User MSISDN is: 2544722210
[Tue May 09 01:14:52.530269 2017] [wsgi:error] [pid 32074:tid 140309007640320] User MSISDN is: 2544722039475
[Tue May 09 01:14:59.801512 2017] [wsgi:error] [pid 32139:tid 140308738115328] User MSISDN is: favicon.ico
[Tue May 09 01:15:40.100122 2017] [wsgi:error] [pid 32292:tid 140309007640320] User MSISDN is: 2544722039475
[Tue May 09 01:16:35.712011 2017] [wsgi:error] [pid 32293:tid 140308771686144] User MSISDN is: 2544722039475
Pastebin to application code:
https://pastebin.com/e9dNU1r8
/r/flask
https://redd.it/6a22xp
I'm having a very strange issue. I provide an URL for users to access their personal reports (http://subdomain.domain.net/<input_str>) and when I test it it works just fine, but in production the MSISDN variable is always a static file from the app directory. Has anybody encountered an issue like this before?
[Tue May 09 00:28:48.398973 2017] [wsgi:error] [pid 30477:tid 140308822042368] User MSISDN is: apple-touch-icon.png
[Tue May 09 00:35:30.320477 2017] [wsgi:error] [pid 30740:tid 140308922754816] User MSISDN is: license.txt
[Tue May 09 00:35:30.332013 2017] [wsgi:error] [pid 30740:tid 140308914362112] User MSISDN is: rss
[Tue May 09 00:35:30.336705 2017] [wsgi:error] [pid 30740:tid 140308889184000] User MSISDN is: robots.txt
[Tue May 09 00:35:30.337023 2017] [wsgi:error] [pid 30740:tid 140308905969408] User MSISDN is: sitemap.xml
[Tue May 09 01:11:56.253829 2017] [wsgi:error] [pid 32139:tid 140308830435072] User MSISDN is: 254799369284
[Tue May 09 01:14:11.350096 2017] [wsgi:error] [pid 32074:tid 140308763293440] User MSISDN is: 2544722210
[Tue May 09 01:14:52.530269 2017] [wsgi:error] [pid 32074:tid 140309007640320] User MSISDN is: 2544722039475
[Tue May 09 01:14:59.801512 2017] [wsgi:error] [pid 32139:tid 140308738115328] User MSISDN is: favicon.ico
[Tue May 09 01:15:40.100122 2017] [wsgi:error] [pid 32292:tid 140309007640320] User MSISDN is: 2544722039475
[Tue May 09 01:16:35.712011 2017] [wsgi:error] [pid 32293:tid 140308771686144] User MSISDN is: 2544722039475
Pastebin to application code:
https://pastebin.com/e9dNU1r8
/r/flask
https://redd.it/6a22xp
user permissions and own admin panel
So I'm learning Django for an inventory management web app I'm building.
Basically, I want users to be able to track their inventory, adding to it and deleting etc...but obviously **only their** items. I don't want to expose them to the *project's* Admin app though.
So how would I go about doing this? Do I *need* something like django-guardian? And how can I utilize all the batteries inside the admin app *without* sharing the *project's* admin app with them?
Each sign up user (owner) can add other users (employees) through their admin panel, with whom they will share it afterwards. Obviously those invited users will have less permissions: they can add items, but not invite other users to the owner's panel. And all users will have less permission than the admin (me).
Any pointers are very much appreciated!
/r/djangolearning
https://redd.it/69koz4
So I'm learning Django for an inventory management web app I'm building.
Basically, I want users to be able to track their inventory, adding to it and deleting etc...but obviously **only their** items. I don't want to expose them to the *project's* Admin app though.
So how would I go about doing this? Do I *need* something like django-guardian? And how can I utilize all the batteries inside the admin app *without* sharing the *project's* admin app with them?
Each sign up user (owner) can add other users (employees) through their admin panel, with whom they will share it afterwards. Obviously those invited users will have less permissions: they can add items, but not invite other users to the owner's panel. And all users will have less permission than the admin (me).
Any pointers are very much appreciated!
/r/djangolearning
https://redd.it/69koz4
reddit
user permissions and own admin panel • r/djangolearning
So I'm learning Django for an inventory management web app I'm building. Basically, I want users to be able to track their inventory, adding to...
Returning two lists
I have two classes (Series & Episode) in my models.py
Code:
class Series(models.Model):
genre = models.CharField(max_length=100)
year = models.CharField(max_length=4)
logo = models.FileField()
show_title = models.CharField(max_length=200)
def __str__(self):
return self.show_title + ' - ' + self.year
class Episode(models.Model):
series = models.ForeignKey(Series, on_delete=models.CASCADE)
episode_title = models.CharField(max_length=200)
episode_num = models.CharField(max_length=3)
season = models.CharField(max_length=3)
My function detail in views.py:
def detail(request, show_title, episode_title):
series = get_object_or_404(Series, id=show_title)
episode = get_object_or_404(Episode, id=episode_title)
return render(request, 'shows/detail.html', {'series':series,'episode':episode})
Everything works if I get rid of:
- episode = get_object_or_404(Episode, id=episode_title)
- 'episode':episode
- and remove the parameter 'episode)title
But I want to access the variables that are in Episode, and print those variables in my table. I currently only have access to Series.
Html:
<table>
<tr class = "table-header">
<td>Episode</td>
<td>Episode Title</td>
<td>Genre</td>
<td>Year</td>
</tr>
<tr>
<td>S3E14</td>
<td>{{ episode.episode_title }}</td>
<td>{{ series.genre }}</td>
<td>{{ series.year }}</td>
</tr>
</table>
Error code:
TypeError: detail() missing 1 required positional argument: 'episode_title'
I am not understanding this error code. How am I able to get this code working?
/r/djangolearning
https://redd.it/6a3q0w
I have two classes (Series & Episode) in my models.py
Code:
class Series(models.Model):
genre = models.CharField(max_length=100)
year = models.CharField(max_length=4)
logo = models.FileField()
show_title = models.CharField(max_length=200)
def __str__(self):
return self.show_title + ' - ' + self.year
class Episode(models.Model):
series = models.ForeignKey(Series, on_delete=models.CASCADE)
episode_title = models.CharField(max_length=200)
episode_num = models.CharField(max_length=3)
season = models.CharField(max_length=3)
My function detail in views.py:
def detail(request, show_title, episode_title):
series = get_object_or_404(Series, id=show_title)
episode = get_object_or_404(Episode, id=episode_title)
return render(request, 'shows/detail.html', {'series':series,'episode':episode})
Everything works if I get rid of:
- episode = get_object_or_404(Episode, id=episode_title)
- 'episode':episode
- and remove the parameter 'episode)title
But I want to access the variables that are in Episode, and print those variables in my table. I currently only have access to Series.
Html:
<table>
<tr class = "table-header">
<td>Episode</td>
<td>Episode Title</td>
<td>Genre</td>
<td>Year</td>
</tr>
<tr>
<td>S3E14</td>
<td>{{ episode.episode_title }}</td>
<td>{{ series.genre }}</td>
<td>{{ series.year }}</td>
</tr>
</table>
Error code:
TypeError: detail() missing 1 required positional argument: 'episode_title'
I am not understanding this error code. How am I able to get this code working?
/r/djangolearning
https://redd.it/6a3q0w
reddit
Returning two lists • r/djangolearning
I have two classes (Series & Episode) in my models.py Code: class Series(models.Model): genre = models.CharField(max_length=100) ...
How to profile Django views
https://rock-it.pl/how-to-profile-django-views/
/r/django
https://redd.it/6a3vq7
https://rock-it.pl/how-to-profile-django-views/
/r/django
https://redd.it/6a3vq7
Rock IT
How to profile Django views
If you are programming for some time, you probably heard that sentence: I made that mistake many times - I've spent lot of time optimizing something that was totally irrelevant. Basically, most of the time you should focus to create readable, maintainable…
What's everyone working on this week?
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.
/r/Python
https://redd.it/6a5m37
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.
/r/Python
https://redd.it/6a5m37
reddit
What's everyone working on this week? • r/Python
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your...
Hiring | Simons Foundation | Full Stack Software Engineer | Onsite/Full time | New York City, NY
Simons Foundation is looking for a passionate Full Stack Software Engineer!
Simons Foundation exists to support basic - or discovery-driven - scientific research. We do this through direct grants in four areas: Mathematics and Physical Sciences, Life Sciences, Autism Research (SFARI), and Education & Outreach. This is only a quick blurb of what we do! If you want to find out more, please visit www.simonsfoundation.org. I'm certain you'll be interested!
This role specifically is for my team. We're a small (9) team of passionate engineers. You'll be joining a yet young project creating Software critical to Simons Foundation's mission.
What we're looking for: Passion (aka desire/enthusiasm, not any sort of JS library), Design Patterns, Python, Django, React, Single Page App experience, webpack, APIs.
If you're interested, please either reach out to me (the hiring manager) @ sford@simonsfoundation.org, or apply directly below.
https://simonsfoundation.wd1.myworkdayjobs.com/en-US/simonsfoundationcareers/job/160-Fifth-Avenue/Software-Engineer_R0000050.
/r/django
https://redd.it/6a52js
Simons Foundation is looking for a passionate Full Stack Software Engineer!
Simons Foundation exists to support basic - or discovery-driven - scientific research. We do this through direct grants in four areas: Mathematics and Physical Sciences, Life Sciences, Autism Research (SFARI), and Education & Outreach. This is only a quick blurb of what we do! If you want to find out more, please visit www.simonsfoundation.org. I'm certain you'll be interested!
This role specifically is for my team. We're a small (9) team of passionate engineers. You'll be joining a yet young project creating Software critical to Simons Foundation's mission.
What we're looking for: Passion (aka desire/enthusiasm, not any sort of JS library), Design Patterns, Python, Django, React, Single Page App experience, webpack, APIs.
If you're interested, please either reach out to me (the hiring manager) @ sford@simonsfoundation.org, or apply directly below.
https://simonsfoundation.wd1.myworkdayjobs.com/en-US/simonsfoundationcareers/job/160-Fifth-Avenue/Software-Engineer_R0000050.
/r/django
https://redd.it/6a52js
Zero to hero with Python
https://www.youtube.com/watch?v=zh9NgGf3cxU&index=15&list=PL1Z_7yg6Pa3CURAEFLwzXRYrhGcQskRhY
/r/Python
https://redd.it/6a3jrj
https://www.youtube.com/watch?v=zh9NgGf3cxU&index=15&list=PL1Z_7yg6Pa3CURAEFLwzXRYrhGcQskRhY
/r/Python
https://redd.it/6a3jrj
YouTube
Zero to hero with Python
The Python 3 Bible™ | Go from Beginner to Advanced in Python ☞ http://learnstartup.net/p/HypDDyEml Python for Data Analysis and Visualization - 32 HD Hours !...
nbmerge: merge / concatenate Jupyter notebooks
https://github.com/jbn/nbmerge
/r/IPython
https://redd.it/6a5ele
https://github.com/jbn/nbmerge
/r/IPython
https://redd.it/6a5ele
GitHub
GitHub - jbn/nbmerge: A tool to merge / concatenate Jupyter (IPython) notebooks
A tool to merge / concatenate Jupyter (IPython) notebooks - jbn/nbmerge
4 Python libraries for building great command-line user interfaces
https://opensource.com/article/17/5/4-practical-python-libraries
/r/Python
https://redd.it/6a67l7
https://opensource.com/article/17/5/4-practical-python-libraries
/r/Python
https://redd.it/6a67l7
Opensource.com
4 Python libraries for building great command-line user interfaces
In the second installment of a two-part series on terminal applications with great command-line UIs, we explore Prompt Toolkit, Click, Pygments, and Fuzzy Finder.
Hey Python/pandas users. Check this out. I've used this as part of my day-to-day workflow since it was released a couple months ago and I'm hooked. It's a better way to store, retrieve, and explore my data in a way that's seamlessly integrated with my preferred analysis environment (Python).
https://data.world/nrippner/explore-the-data-world-python-sdk/file/ddw_SDK.ipynb
or, to look at notebook without data.world account:
https://github.com/nrippner/misc/blob/master/ddw_SDK.ipynb
/r/pystats
https://redd.it/6a7rnd
https://data.world/nrippner/explore-the-data-world-python-sdk/file/ddw_SDK.ipynb
or, to look at notebook without data.world account:
https://github.com/nrippner/misc/blob/master/ddw_SDK.ipynb
/r/pystats
https://redd.it/6a7rnd
data.world
Login | data.world
Requests per second with database query
I am trying to get a sense of performance based on my set up because I feel like I am way under performing.
I have a flask container on AWS ECS with 1024Cpu Units and 2GB of memory.
The containerized app uses uwsgi and nginx.
The query I am running is a sql-alchemy pagianted query with a page size of 20. Running this same query from SequelPro takes 109ms. This is against a remote Aurora RDS.
However when load testing this endpoint (with 2 containers under an ELB) the requests per second is hardly double digits. Is this just a symptom of having a remote db and small hardware profile on the container?
/r/flask
https://redd.it/6a79u3
I am trying to get a sense of performance based on my set up because I feel like I am way under performing.
I have a flask container on AWS ECS with 1024Cpu Units and 2GB of memory.
The containerized app uses uwsgi and nginx.
The query I am running is a sql-alchemy pagianted query with a page size of 20. Running this same query from SequelPro takes 109ms. This is against a remote Aurora RDS.
However when load testing this endpoint (with 2 containers under an ELB) the requests per second is hardly double digits. Is this just a symptom of having a remote db and small hardware profile on the container?
/r/flask
https://redd.it/6a79u3
reddit
Requests per second with database query • r/flask
I am trying to get a sense of performance based on my set up because I feel like I am way under performing. I have a flask container on AWS ECS...
[D] Machine Learning - WAYR (What Are You Reading) - Week 25
This is a place to share machine learning research papers, journals, and articles that you're reading this week. If it relates to what you're researching, by all means elaborate and give us your insight, otherwise it could just be an interesting paper you've read.
Please try to provide some insight from your understanding and please don't post things which are present in wiki.
Preferably you should link the arxiv page (not the PDF, you can easily access the PDF from the summary page but not the other way around) or any other pertinent links.
Previous weeks :
|1-10|11-20|21-30|
|----|-----|-----|
|[Week 1](https://www.reddit.com/r/MachineLearning/comments/4qyjiq/machine_learning_wayr_what_are_you_reading_week_1/)|[Week 11](https://www.reddit.com/r/MachineLearning/comments/57xw56/discussion_machine_learning_wayr_what_are_you/)|[Week 21](https://www.reddit.com/r/MachineLearning/comments/60ildf/d_machine_learning_wayr_what_are_you_reading_week/)|
|[Week 2](https://www.reddit.com/r/MachineLearning/comments/4s2xqm/machine_learning_wayr_what_are_you_reading_week_2/)|[Week 12](https://www.reddit.com/r/MachineLearning/comments/5acb1t/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 22](https://www.reddit.com/r/MachineLearning/comments/64jwde/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 3](https://www.reddit.com/r/MachineLearning/comments/4t7mqm/machine_learning_wayr_what_are_you_reading_week_3/)|[Week 13](https://www.reddit.com/r/MachineLearning/comments/5cwfb6/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 23](https://www.reddit.com/r/MachineLearning/comments/674331/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 4](https://www.reddit.com/r/MachineLearning/comments/4ub2kw/machine_learning_wayr_what_are_you_reading_week_4/)|[Week 14](https://www.reddit.com/r/MachineLearning/comments/5fc5mh/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 24](https://www.reddit.com/r/MachineLearning/comments/68hhhb/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 5](https://www.reddit.com/r/MachineLearning/comments/4xomf7/machine_learning_wayr_what_are_you_reading_week_5/)|[Week 15](https://www.reddit.com/r/MachineLearning/comments/5hy4ur/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 6](https://www.reddit.com/r/MachineLearning/comments/4zcyvk/machine_learning_wayr_what_are_you_reading_week_6/)|[Week 16](https://www.reddit.com/r/MachineLearning/comments/5kd6vd/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 7](https://www.reddit.com/r/MachineLearning/comments/52t6mo/machine_learning_wayr_what_are_you_reading_week_7/)|[Week 17](https://www.reddit.com/r/MachineLearning/comments/5ob7dx/discussion_machine_learning_wayr_what_are_you/)||
|[Week 8](https://www.reddit.com/r/MachineLearning/comments/53heol/machine_learning_wayr_what_are_you_reading_week_8/)|[Week 18](https://www.reddit.com/r/MachineLearning/comments/5r14yd/discussion_machine_learning_wayr_what_are_you/)||
|[Week 9](https://www.reddit.com/r/MachineLearning/comments/54kvsu/machine_learning_wayr_what_are_you_reading_week_9/)|[Week 19](https://www.reddit.com/r/MachineLearning/comments/5tt9cz/discussion_machine_learning_wayr_what_are_you/)||
|[Week 10](https://www.reddit.com/r/MachineLearning/comments/56s2oa/discussion_machine_learning_wayr_what_are_you/)|[Week 20](https://www.reddit.com/r/MachineLearning/comments/5wh2wb/d_machine_learning_wayr_what_are_you_reading_week/)||
Most upvoted papers two weeks ago:
/u/whenmaster: https://arxiv.org/abs/1701.07875v2
/u/nicrob355982: https://arxiv.org/abs/1507.04808
Besides that, there are no rules, have fun.
Hey, seems there was a little hiccup where last week's WAYR post wasn't stickied, so I'm going to change the bot to post every other week.
/r/MachineLearning
https://redd.it/69teiz
This is a place to share machine learning research papers, journals, and articles that you're reading this week. If it relates to what you're researching, by all means elaborate and give us your insight, otherwise it could just be an interesting paper you've read.
Please try to provide some insight from your understanding and please don't post things which are present in wiki.
Preferably you should link the arxiv page (not the PDF, you can easily access the PDF from the summary page but not the other way around) or any other pertinent links.
Previous weeks :
|1-10|11-20|21-30|
|----|-----|-----|
|[Week 1](https://www.reddit.com/r/MachineLearning/comments/4qyjiq/machine_learning_wayr_what_are_you_reading_week_1/)|[Week 11](https://www.reddit.com/r/MachineLearning/comments/57xw56/discussion_machine_learning_wayr_what_are_you/)|[Week 21](https://www.reddit.com/r/MachineLearning/comments/60ildf/d_machine_learning_wayr_what_are_you_reading_week/)|
|[Week 2](https://www.reddit.com/r/MachineLearning/comments/4s2xqm/machine_learning_wayr_what_are_you_reading_week_2/)|[Week 12](https://www.reddit.com/r/MachineLearning/comments/5acb1t/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 22](https://www.reddit.com/r/MachineLearning/comments/64jwde/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 3](https://www.reddit.com/r/MachineLearning/comments/4t7mqm/machine_learning_wayr_what_are_you_reading_week_3/)|[Week 13](https://www.reddit.com/r/MachineLearning/comments/5cwfb6/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 23](https://www.reddit.com/r/MachineLearning/comments/674331/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 4](https://www.reddit.com/r/MachineLearning/comments/4ub2kw/machine_learning_wayr_what_are_you_reading_week_4/)|[Week 14](https://www.reddit.com/r/MachineLearning/comments/5fc5mh/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 24](https://www.reddit.com/r/MachineLearning/comments/68hhhb/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 5](https://www.reddit.com/r/MachineLearning/comments/4xomf7/machine_learning_wayr_what_are_you_reading_week_5/)|[Week 15](https://www.reddit.com/r/MachineLearning/comments/5hy4ur/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 6](https://www.reddit.com/r/MachineLearning/comments/4zcyvk/machine_learning_wayr_what_are_you_reading_week_6/)|[Week 16](https://www.reddit.com/r/MachineLearning/comments/5kd6vd/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 7](https://www.reddit.com/r/MachineLearning/comments/52t6mo/machine_learning_wayr_what_are_you_reading_week_7/)|[Week 17](https://www.reddit.com/r/MachineLearning/comments/5ob7dx/discussion_machine_learning_wayr_what_are_you/)||
|[Week 8](https://www.reddit.com/r/MachineLearning/comments/53heol/machine_learning_wayr_what_are_you_reading_week_8/)|[Week 18](https://www.reddit.com/r/MachineLearning/comments/5r14yd/discussion_machine_learning_wayr_what_are_you/)||
|[Week 9](https://www.reddit.com/r/MachineLearning/comments/54kvsu/machine_learning_wayr_what_are_you_reading_week_9/)|[Week 19](https://www.reddit.com/r/MachineLearning/comments/5tt9cz/discussion_machine_learning_wayr_what_are_you/)||
|[Week 10](https://www.reddit.com/r/MachineLearning/comments/56s2oa/discussion_machine_learning_wayr_what_are_you/)|[Week 20](https://www.reddit.com/r/MachineLearning/comments/5wh2wb/d_machine_learning_wayr_what_are_you_reading_week/)||
Most upvoted papers two weeks ago:
/u/whenmaster: https://arxiv.org/abs/1701.07875v2
/u/nicrob355982: https://arxiv.org/abs/1507.04808
Besides that, there are no rules, have fun.
Hey, seems there was a little hiccup where last week's WAYR post wasn't stickied, so I'm going to change the bot to post every other week.
/r/MachineLearning
https://redd.it/69teiz
Reddit
From the MachineLearning community on Reddit
Explore this post and more from the MachineLearning community
Looking for resources for deserializing JSON into multiple models
I'm very new to both python and Django and am having difficulty finding the right documentation to work through my current problem.
I am trying to take JSON from a url and commit it to a database. For the example below I would like to commit "name", "type", and "level" to a model called Items and all of the details to a model called ItemDetails.
[
{
"name": "Abomination Hammer",
"type": "Weapon",
"level": 0,
"rarity": "Fine",
"vendor_value": 0,
"default_skin": 5014,
"game_types": [
"Activity",
"Wvw",
"Dungeon",
"Pve"
],
"flags": [
"NoSell",
"SoulbindOnAcquire",
"SoulBindOnUse"
],
"restrictions": [],
"id": 15,
"chat_link": "[&AgEPAAAA]",
"details": {
"type": "Hammer",
"damage_type": "Physical",
"min_power": 146,
"max_power": 165,
"defense": 0,
"infusion_slots": [],
"infix_upgrade": {
"id": 112,
"attributes": []
},
"secondary_suffix_item_id": ""
}
}
]
So far the only way I've found to do it is to load the JSON from the url
def jsonload(url):
response = urllib.request.urlopen(url).read()
jsonstring = str(response, 'utf-8')
json_load = json.loads(jsonstring)
return json_load
Then loop through each item (like the one shown above) and save the fields I want to use.
i = Items(id=data.get('id'),
name=data.get('name'),
type=data.get('type'),
level=data.get('level'),
)
i.save()
From what I've been able to gather it seems like this is better suited for a deserializer, but I can't find anything about deserializing JSON from a url into multiple model classes.
/r/django
https://redd.it/6a7mq5
I'm very new to both python and Django and am having difficulty finding the right documentation to work through my current problem.
I am trying to take JSON from a url and commit it to a database. For the example below I would like to commit "name", "type", and "level" to a model called Items and all of the details to a model called ItemDetails.
[
{
"name": "Abomination Hammer",
"type": "Weapon",
"level": 0,
"rarity": "Fine",
"vendor_value": 0,
"default_skin": 5014,
"game_types": [
"Activity",
"Wvw",
"Dungeon",
"Pve"
],
"flags": [
"NoSell",
"SoulbindOnAcquire",
"SoulBindOnUse"
],
"restrictions": [],
"id": 15,
"chat_link": "[&AgEPAAAA]",
"details": {
"type": "Hammer",
"damage_type": "Physical",
"min_power": 146,
"max_power": 165,
"defense": 0,
"infusion_slots": [],
"infix_upgrade": {
"id": 112,
"attributes": []
},
"secondary_suffix_item_id": ""
}
}
]
So far the only way I've found to do it is to load the JSON from the url
def jsonload(url):
response = urllib.request.urlopen(url).read()
jsonstring = str(response, 'utf-8')
json_load = json.loads(jsonstring)
return json_load
Then loop through each item (like the one shown above) and save the fields I want to use.
i = Items(id=data.get('id'),
name=data.get('name'),
type=data.get('type'),
level=data.get('level'),
)
i.save()
From what I've been able to gather it seems like this is better suited for a deserializer, but I can't find anything about deserializing JSON from a url into multiple model classes.
/r/django
https://redd.it/6a7mq5
reddit
Looking for resources for deserializing JSON into... • r/django
I'm very new to both python and Django and am having difficulty finding the right documentation to work through my current problem. I am trying...