This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
for row in csv.reader(open('city.csv', encoding='utf-8') ): | |
print(row) | |
#donde row es el arreglo donde se contiene cada fila del archivo csv. | |
#para acceder a cada posicion se accede mediante su indice | |
#ej: print(row[5]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from app import db | |
class Pais(db.Model): | |
id = db.Column(db.Integer, primary_key=True) | |
codigo = db.Column(db.String(8), index=True, unique = True , nullable = True) | |
nombre = db.Column(db.String(32), index=True, unique = True) | |
regiones = db.relationship('Region' , backref = "pais" , lazy="dynamic" ) | |
ciudades = db.relationship('Ciudad' , backref = "pais" , lazy="dynamic" ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from app import db | |
class Pais(db.Model): | |
id = db.Column(db.Integer, primary_key=True) | |
codigo = db.Column(db.String(8), index=True, unique = True , nullable = True) | |
nombre = db.Column(db.String(32), index=True, unique = True) | |
##Las relaciones indican vistas de alto nivel de la relación entre: | |
##Paises y sus regiones | |
##Paises y sus ciudades |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Cristian Buitrago´s Weather API request | |
* First Iteration | |
* Sample with XMLHttpRequest classic's with callbacks | |
* Execute: browser only | |
* Architectural style: Callback | |
* Calls openweathermap's API(openweathermap.com/current for info) | |
*/ | |
function get_weather_data(url, success , fail){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Cristian Buitrago´s Weather API | |
* Second Iteration | |
* Sample with XMLHttpRequest classic's with callbacks, this time with arrow syntax | |
* Execute with any web browser | |
* method: GET | |
* Architectural Style: Callback | |
* Calls openweathermap's API(openweathermap.com/current for info) | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Cristian Buitrago´s Weather API | |
* Third Iteration | |
* Sample with Native https library(nodejs) | |
* method: GET | |
* Architectural Style: Callback | |
* Execute: nodejs | |
* Calls openweathermap's API(openweathermap.com/current for info) | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Cristian Buitrago´s Weather API | |
* Fourth Iteration | |
* Sample with Node js's "request", third party library | |
* Execute: nodejs | |
* Architectural Style: Callback | |
* method: GET | |
* Calls openweathermap's API(openweathermap.com/current for info) | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Cristian Buitrago´s Weather API | |
* Fifth Iteration | |
* Sample with Node js's "needle", third party library | |
* Execute: nodejs | |
* Architechtural Style: Callback | |
* method: GET | |
* Calls openweathermap's API(openweathermap.com/current for info) | |
*/ | |
const needle = require('needle'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Cristian Buitrago´s Weather API | |
* Fourth Iteration | |
* Sample with Node js's "axios", third party library | |
* Execute: nodejs | |
* Architectural style: Promises | |
* method: GET | |
* Calls openweathermap's API(openweathermap.com/current for info) | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Cristian Buitrago´s Weather API | |
* Seventh Iteration | |
* Sample with Node js's "axios", third party library | |
* Execute: nodejs | |
* Architectural style: Promises | |
* method: GET | |
* Calls openweathermap's API(openweathermap.com/current for info) | |
*/ |
OlderNewer