how to get a CSV from an API and map it into a model - django

I am using Django and I want to get data via an API in CSV format and import it to my models but I don't know how to do this properly.
Please help me.

You might want to take a look at django import-export

Related

How to Create an api to upload xml file in django

I need to create an API in Django that will use to take an XML file.
Main Question:
I have created models and serialization and but files that have not to save in Django after extracting the data file will be deleted. now I can not understand the view part(api) please help.
If you wish to upload a file using DRF, you might want to take a look at this topic. It should give you an idea of what to do

Django Rest Framework import CSV to models

is there any way to import csv file to django rest framework models?
Thank You in advance.
Using python csv you can open/read/write/modify any csv file.
Using this method, you can parse your file and save it using DRF.
I wont post any code because its a general understanding question.
Good Luck.
https://docs.python.org/2/library/csv.html
Reading a CSV file using Python

How i can make script(simple .py file) for fetch data from magento using python?

In this only create python file in one method is read, in this method through fetch the data of magento.
How i can do this, anyone can help me ?
from magento.api import API
import warnings
with API('url','username','passward') as magento:
result=magento.call('catalog_product.info',[int(1),None,None,'id'])
print result

Make an api using django-rest-framework and pandas

I am planning to make an api using django-rest-framework and pandas. My task is to use the already existing api of my project and collect the data and convert it to pandas dataframe and make my own api using django-rest-framework.I am not able to understand should I use my own django models and use them with already existing models or should I don't use my models and use the already existing api data models. How should I implement this using django-rest-framework. Can someone help me iam a bit confused.

Using django RESTful api to get data and show it in a table?

I am using REST api to get data from a mongodb on a server. Currently I can display the data from mongodb on to a browser using django rest framework, but this data is shown in JSON format.
I want to display this data it in a table.
I am still not clear on how to use this data in a template rather than just return a response that throws data onto a browser.Do I use a serializer for this ?
A google search revealed these 2 results:
Displaying a Table in Django from Database
http://django-tables2.readthedocs.org/en/latest/#tutorial
Both the code assume that the model is defined within the Django, but I am using the REST to get data.
I am using class based views and mixins as shown below for processing http requests on
class RestDjango(View, RequestMixin, ResponseMixin):
.........
.........
p.s:
I am using 0.3.3 version of Django REST Framework.
I am new to REST so please feel free to point me to any tutorials/articles to help me.
Do I use a serializer for this ?
No. You use renderer for this.
http://www.django-rest-framework.org/api-guide/renderers/#templatehtmlrenderer
I think the example code in the link is clear enough. Simply pass the query result as context and create your table inside template.