-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit daba424
Showing
540 changed files
with
378,926 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import requests | ||
import json | ||
|
||
request = requests.get('http://api.open-notify.org') | ||
print(request.text) | ||
print(request.status_code) | ||
|
||
people = requests.get('http://api.open-notify.org/astros.json') | ||
print(people.text) | ||
people_json = people.json() | ||
print(people_json) | ||
|
||
#To print the number of people in space | ||
print("Number of people in space:",people_json['number'])#To print the names of people in space using a for loop | ||
for p in people_json['people']: | ||
print(p['name']) | ||
|
||
## Codigo Facilito | ||
|
||
if __name__ == '__main__': | ||
url = 'http://www.google.com.co' | ||
response = requests.get(url) #si regresa 200 todo esta bien | ||
|
||
if response.status_code == 200: | ||
content = response.content | ||
print(response.content) # entrega todas las etiquetas html de la web | ||
|
||
file = open('google.html','wb') | ||
file.write(content) | ||
file.close() | ||
|
||
print('\n\n\n\n') | ||
|
||
url = 'http://httpbin.org/get' | ||
args = { 'nombre' : 'Robinson' , 'curso' : 'Python' , 'nivel' : 'Intermedio'} | ||
response = requests.get(url , params = args) #si regresa 200 todo esta bien | ||
print(response.url) | ||
|
||
if response.status_code == 200: | ||
"""content = response.content | ||
print(content) # entrega todas las etiquetas html de la web | ||
response_json = response.json() | ||
print(response_json) | ||
origin = response_json['origin'] | ||
print(origin)""" | ||
response_json = json.loads(response.text) | ||
origin = response_json['origin'] | ||
print(origin) | ||
|
||
url = 'http://httpbin.org/post' | ||
payload = { 'nombre' : 'Robinson' , 'curso' : 'Python' , 'nivel' : 'Intermedio'} | ||
headers = {'Content-Type' : 'application/json' , 'acces_token' : '12345'} | ||
response = requests.post(url , json = payload , headers = headers) #serializa: convierte en un diccionario json | ||
#esponse = requests.post(url , data = json.dumps(payload)) #nosotros serializamos los datos con json.dumps() | ||
|
||
print(response.url) | ||
|
||
if response.status_code == 200: | ||
#print(response.content) | ||
headers_response = response.headers | ||
server = headers_response['Server'] | ||
print(server) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import requests | ||
|
||
if __name__ == '__main__': | ||
url = 'https://es.theepochtimes.com/assets/uploads/2019/05/GatitoBlanco-795x447.jpg' | ||
|
||
response = requests.get(url, stream = True) #stream realiza la peticion sin descargar el contenido sin cerrar la conexion | ||
with open('image.jpg','wb') as file: #importante para archivos pesados como pdf, imagenes y videos | ||
for chunk in response.iter_content():#descarga el contenido poco a poco | ||
file.write(chunk) | ||
|
||
response.close() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import requests | ||
|
||
client_id = '369215fa00432fd6b039' | ||
client_secret = 'bcce46a5a7943981310e8f7cb1425bf1541507aa' | ||
|
||
code = '35d1a2e36db2d2dbc24' | ||
access_token = '373000f72e50c19b24a930893e1b4ef322b85802' | ||
|
||
if __name__ == '__main__': | ||
url = 'http://github.com/login/oauth/access_token' | ||
payload = {'client_id' : client_id , 'client_secret' : client_secret , 'code' : code} | ||
headers = {'Accept' : 'application/json'} | ||
|
||
response = requests.post(url, json = payload , headers = headers) | ||
|
||
if response.status_code == 200: | ||
response_json = response.json() | ||
|
||
access_token = respnse_json['access_token'] | ||
print(access_token) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import requests | ||
|
||
def get_pokemons(url = 'http://pokeapi.co/api/v2/pokemon-form/' , offset=20): | ||
args = {'offset' : offset} if offset else {} | ||
|
||
response =requests.get(url , params = args) | ||
|
||
if response.status_code == 200: | ||
|
||
payload = response.json() | ||
results = payload.get('results',[]) | ||
|
||
if results: | ||
for pokemon in results: | ||
name = pokemon['name'] | ||
print(name) | ||
|
||
next = input("Continuar listando? Y/N").lower() | ||
|
||
if next =='y': | ||
get_pokemons(offset = offset + 20) | ||
|
||
if __name__ == '__main__': | ||
url = 'http://pokeapi.co/api/v2/pokemon-form/' #obtiene una lista de pokemon | ||
get_pokemons() | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Mon Jun 10 15:27:53 2019 | ||
@author: meco | ||
""" | ||
|
||
"""Para simular con el módulo secrets el ejemplo visto en el apartado anterior, | ||
basta ejecutar el siguiente código:""" | ||
|
||
import secrets | ||
secrets.token_hex(20) | ||
##>>>'ccaf5c9a22e854856d0c5b1b96c81e851bafb288' | ||
|
||
"""En ciertas ocasiones, puede que queramos que el secreto forma parte de una URL, | ||
por ejemplo, para resetear un password. En ese caso es más apropiado usar la función | ||
token_urlsafedel mismo modo. Esta nos garantiza que los caracteres generados son | ||
seguros de usar en una URL:""" | ||
|
||
secrets.token_urlsafe(20) | ||
##>>>'dxM4-BL1CPeHYIMmXNQevdlsvhI' | ||
|
||
"""Hay que tener en cuenta que el número que se pasa entre paréntesis no es la longitud | ||
del número de caractéres, si no de bytes. En el caso de la función token_hex, 1 byte se | ||
corresponden con 2 dígitos hexadecimales. En cuanto a la función token_urlsafe, la cadena | ||
devuelta está codificada en Base 64, lo que viene a ser 1,3 caractéres por cada byte (aunque | ||
no siempre es así). | ||
Si no se indica el número de bytes a utilizar, el módulo secrets usará uno razonable por | ||
defecto (que puede cambiar en cualquier momento en futuras actualizaciones).""" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="es-419"><head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"><meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image"><title>Google</title><script nonce="NuAo6DrhBSbOLYDiQ3exOg==">(function(){window.google={kEI:'26rhXc7GMKOc5wLNn6SgAg',kEXPI:'0,1353747,5662,730,224,1575,3151,378,207,1017,2187,10,713,338,175,32,332,123,548,271,33,179,3,27,97,154,4,60,133,593,429,1129273,143,1197728,421,329118,1294,12383,4855,32692,15247,867,17444,11240,363,3320,5505,8384,1119,2,579,727,2431,1362,4323,4968,773,2254,4740,2136,974,6204,1719,1808,1976,2044,8909,3192,2105,2016,38,920,681,192,1217,5711,3061,2,631,3240,8066,2884,20,318,234,3913,1,368,2778,519,401,991,1285,8,2796,889,78,601,11,14,667,612,2212,202,37,292,2091,324,193,513,953,8,48,820,3438,260,52,1137,2,2063,606,1315,524,184,546,49,1702,1705,242,418,329,429,44,1009,93,328,1284,16,84,336,81,2661,1404,607,474,207,7,1125,748,1039,603,1594,897,133,773,1217,331,524,7,729,591,1574,435,2270,489,98,102,1345,770,5028,663,52,2832,257,582,111,929,1042,376,801,1282,281,778,565,1058,6,280,562,1227,361,920,584,1275,699,655,25,173,829,565,88,41,441,404,201,203,99,2,433,508,846,126,401,43,2,1,3,249,943,127,97,659,991,258,6,259,345,16,59,9,356,731,9,275,2,657,77,1816,135,232,293,70,112,225,162,46,13,5,423,443,280,1518,66,1,138,145,467,111,156,380,64,415,319,428,64,5865151,1805894,4194851,2799595,4,1572,549,333,444,1,2,80,1,900,896,1,8,1,2,2551,1,748,141,59,736,563,1,4265,1,1,1,1,3,7,128,338,57,12,46,25,35,10,4,4,1,2,23965063',authuser:0,kscs:'c9c918f0_26rhXc7GMKOc5wLNn6SgAg',kGL:'CO',kBL:'99lT'};google.sn='webhp';google.kHL='es-419';google.jsfs='Ffpdje';})();(function(){google.lc=[];google.li=0;google.getEI=function(a){for(var b;a&&(!a.getAttribute||!(b=a.getAttribute("eid")));)a=a.parentNode;return b||google.kEI};google.getLEI=function(a){for(var b=null;a&&(!a.getAttribute||!(b=a.getAttribute("leid")));)a=a.parentNode;return b};google.https=function(){return"https:"==window.location.protocol};google.ml=function(){return null};google.time=function(){return(new Date).getTime()};google.log=function(a,b,e,c,g){if(a=google.logUrl(a,b,e,c,g)){b=new Image;var d=google.lc,f=google.li;d[f]=b;b.onerror=b.onload=b.onabort=function(){delete d[f]};google.vel&&google.vel.lu&&google.vel.lu(a);b.src=a;google.li=f+1}};google.logUrl=function(a,b,e,c,g){var d="",f=google.ls||"";e||-1!=b.search("&ei=")||(d="&ei="+google.getEI(c),-1==b.search("&lei=")&&(c=google.getLEI(c))&&(d+="&lei="+c));c="";!e&&google.cshid&&-1==b.search("&cshid=")&&"slh"!=a&&(c="&cshid="+google.cshid);a=e||"/"+(g||"gen_204")+"?atyp=i&ct="+a+"&cad="+b+d+f+"&zx="+google.time()+c;/^http:/i.test(a)&&google.https()&&(google.ml(Error("a"),!1,{src:a,glmm:1}),a="");return a};}).call(this);(function(){google.y={};google.x=function(a,b){if(a)var c=a.id;else{do c=Math.random();while(google.y[c])}google.y[c]=[a,b];return!1};google.lm=[];google.plm=function(a){google.lm.push.apply(google.lm,a)};google.lq=[];google.load=function(a,b,c){google.lq.push([[a],b,c])};google.loadAll=function(a,b){google.lq.push([a,b])};}).call(this);google.f={};(function(){document.documentElement.addEventListener("submit",function(b){var a;if(a=b.target){var c=a.getAttribute("data-submitfalse");a="1"==c||"q"==c&&!a.elements.q.value?!0:!1}else a=!1;a&&(b.preventDefault(),b.stopPropagation())},!0);}).call(this);var a=window.location,b=a.href.indexOf("#");if(0<=b){var c=a.href.substring(b+1);/(^|&)q=/.test(c)&&-1==c.indexOf("#")&&a.replace("/search?"+c.replace(/(^|&)fp=[^&]*/g,"")+"&cad=h")};</script><style>#gbar,#guser{font-size:13px;padding-top:1px !important;}#gbar{height:22px}#guser{padding-bottom:7px !important;text-align:right}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}@media all{.gb1{height:22px;margin-right:.5em;vertical-align:top}#gbar{float:left}}a.gb1,a.gb4{text-decoration:underline !important}a.gb1,a.gb4{color:#00c !important}.gbi .gb4{color:#dd8e27 !important}.gbf .gb4{color:#900 !important} | ||
</style><style>body,td,a,p,.h{font-family:arial,sans-serif}body{margin:0;overflow-y:scroll}#gog{padding:3px 8px 0}td{line-height:.8em}.gac_m td{line-height:17px}form{margin-bottom:20px}.h{color:#36c}.q{color:#00c}.ts td{padding:0}.ts{border-collapse:collapse}em{font-weight:bold;font-style:normal}.lst{height:25px;width:496px}.gsfi,.lst{font:18px arial,sans-serif}.gsfs{font:17px arial,sans-serif}.ds{display:inline-box;display:inline-block;margin:3px 0 4px;margin-left:4px}input{font-family:inherit}a.gb1,a.gb2,a.gb3,a.gb4{color:#11c !important}body{background:#fff;color:black}a{color:#11c;text-decoration:none}a:hover,a:active{text-decoration:underline}.fl a{color:#36c}a:visited{color:#551a8b}a.gb1,a.gb4{text-decoration:underline}a.gb3:hover{text-decoration:none}#ghead a.gb2:hover{color:#fff !important}.sblc{padding-top:5px}.sblc a{display:block;margin:2px 0;margin-left:13px;font-size:11px}.lsbb{background:#eee;border:solid 1px;border-color:#ccc #999 #999 #ccc;height:30px}.lsbb{display:block}.ftl,#fll a{display:inline-block;margin:0 12px}.lsb{background:url(/images/nav_logo229.png) 0 -261px repeat-x;border:none;color:#000;cursor:pointer;height:30px;margin:0;outline:0;font:15px arial,sans-serif;vertical-align:top}.lsb:active{background:#ccc}.lst:focus{outline:none}</style><script nonce="NuAo6DrhBSbOLYDiQ3exOg=="></script></head><body bgcolor="#fff"><script nonce="NuAo6DrhBSbOLYDiQ3exOg==">(function(){var src='/images/nav_logo229.png';var iesg=false;document.body.onload = function(){window.n && window.n();if (document.images){new Image().src=src;} | ||
if (!iesg){document.f&&document.f.q.focus();document.gbqf&&document.gbqf.q.focus();} | ||
} | ||
})();</script><div id="mngb"> <div id=gbar><nobr><b class=gb1>Búsqueda</b> <a class=gb1 href="http://www.google.com.co/imghp?hl=es-419&tab=wi">Imágenes</a> <a class=gb1 href="http://maps.google.com.co/maps?hl=es-419&tab=wl">Maps</a> <a class=gb1 href="https://play.google.com/?hl=es-419&tab=w8">Play</a> <a class=gb1 href="http://www.youtube.com/?gl=CO&tab=w1">YouTube</a> <a class=gb1 href="http://news.google.com.co/nwshp?hl=es-419&tab=wn">Noticias</a> <a class=gb1 href="https://mail.google.com/mail/?tab=wm">Gmail</a> <a class=gb1 href="https://drive.google.com/?tab=wo">Drive</a> <a class=gb1 style="text-decoration:none" href="https://www.google.com.co/intl/es-419/about/products?tab=wh"><u>Más</u> »</a></nobr></div><div id=guser width=100%><nobr><span id=gbn class=gbi></span><span id=gbf class=gbf></span><span id=gbe></span><a href="http://www.google.com.co/history/optout?hl=es-419" class=gb4>Historial web</a> | <a href="/preferences?hl=es-419" class=gb4>Preferencias</a> | <a target=_top id=gb_70 href="https://accounts.google.com/ServiceLogin?hl=es-419&passive=true&continue=http://www.google.com.co/" class=gb4>Iniciar sesión</a></nobr></div><div class=gbh style=left:0></div><div class=gbh style=right:0></div> </div><center><br clear="all" id="lgpd"><div id="lga"><img alt="Google" height="92" src="/images/branding/googlelogo/1x/googlelogo_white_background_color_272x92dp.png" style="padding:28px 0 14px" width="272" id="hplogo"><br><br></div><form action="/search" name="f"><table cellpadding="0" cellspacing="0"><tr valign="top"><td width="25%"> </td><td align="center" nowrap=""><input name="ie" value="ISO-8859-1" type="hidden"><input value="es-419" name="hl" type="hidden"><input name="source" type="hidden" value="hp"><input name="biw" type="hidden"><input name="bih" type="hidden"><div class="ds" style="height:32px;margin:4px 0"><input class="lst" style="color:#000;margin:0;padding:5px 8px 0 6px;vertical-align:top" autocomplete="off" value="" title="Buscar con Google" maxlength="2048" name="q" size="57"></div><br style="line-height:0"><span class="ds"><span class="lsbb"><input class="lsb" value="Buscar con Google" name="btnG" type="submit"></span></span><span class="ds"><span class="lsbb"><input class="lsb" id="tsuid1" value="Me siento con suerte " name="btnI" type="submit"><script nonce="NuAo6DrhBSbOLYDiQ3exOg==">(function(){var id='tsuid1';document.getElementById(id).onclick = function(){if (this.form.q.value){this.checked = 1;if (this.form.iflsig)this.form.iflsig.disabled = false;} | ||
else top.location='/doodles/';};})();</script><input value="AAP1E1EAAAAAXeG46zKNXvxOLDWvs1uTFrgkOdBsZL_P" name="iflsig" type="hidden"></span></span></td><td class="fl sblc" align="left" nowrap="" width="25%"><a href="/advanced_search?hl=es-419&authuser=0">Búsqueda avanzada</a><a href="/language_tools?hl=es-419&authuser=0">Herramientas de idioma</a></td></tr></table><input id="gbv" name="gbv" type="hidden" value="1"><script nonce="NuAo6DrhBSbOLYDiQ3exOg==">(function(){var a,b="1";if(document&&document.getElementById)if("undefined"!=typeof XMLHttpRequest)b="2";else if("undefined"!=typeof ActiveXObject){var c,d,e=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];for(c=0;d=e[c++];)try{new ActiveXObject(d),b="2"}catch(h){}}a=b;if("2"==a&&-1==location.search.indexOf("&gbv=2")){var f=google.gbvu,g=document.getElementById("gbv");g&&(g.value=a);f&&window.setTimeout(function(){location.href=f},0)};}).call(this);</script></form><div id="gac_scont"></div><div style="font-size:83%;min-height:3.5em"><br></div><span id="footer"><div style="font-size:10pt"><div style="margin:19px auto;text-align:center" id="fll"><a href="/intl/es-419/ads/">Programas de publicidad</a><a href="/services/">Soluciones Empresariales</a><a href="/intl/es-419/about.html">Todo acerca de Google</a><a href="http://www.google.com.co/setprefdomain?prefdom=US&sig=K_v-vRfns1RQKxvrJOkaO7ReCTVHU%3D" id="fehl">Google.com</a></div></div><p style="color:#767676;font-size:8pt">© 2019 - <a href="/intl/es-419/policies/privacy/">Privacidad</a> - <a href="/intl/es-419/policies/terms/">Condiciones</a></p></span></center><script nonce="NuAo6DrhBSbOLYDiQ3exOg==">(function(){window.google.cdo={height:0,width:0};(function(){var a=window.innerWidth,b=window.innerHeight;if(!a||!b){var c=window.document,d="CSS1Compat"==c.compatMode?c.documentElement:c.body;a=d.clientWidth;b=d.clientHeight}a&&b&&(a!=google.cdo.width||b!=google.cdo.height)&&google.log("","","/client_204?&atyp=i&biw="+a+"&bih="+b+"&ei="+google.kEI);}).call(this);})();(function(){var u='/xjs/_/js/k\x3dxjs.hp.en.IimNJldFCXo.O/m\x3dsb_he,d/am\x3dwEBgIw/d\x3d1/rs\x3dACT90oHTZQeN4dSe0iTBMVeEbIA17pDuGg';setTimeout(function(){var a=document.createElement("script");a.src=u;google.timers&&google.timers.load&&google.tick&&google.tick("load","xjsls");document.body.appendChild(a)},0);})();(function(){window.google.xjsu='/xjs/_/js/k\x3dxjs.hp.en.IimNJldFCXo.O/m\x3dsb_he,d/am\x3dwEBgIw/d\x3d1/rs\x3dACT90oHTZQeN4dSe0iTBMVeEbIA17pDuGg';})();function _DumpException(e){throw e;} | ||
function _F_installCss(c){} | ||
(function(){google.spjs=false;google.snet=true;google.em=[];google.emw=false;})();(function(){var pmc='{\x22d\x22:{},\x22sb_he\x22:{\x22agen\x22:true,\x22cgen\x22:true,\x22client\x22:\x22heirloom-hp\x22,\x22dh\x22:true,\x22dhqt\x22:true,\x22ds\x22:\x22\x22,\x22ffql\x22:\x22es\x22,\x22fl\x22:true,\x22host\x22:\x22google.com.co\x22,\x22isbh\x22:28,\x22jsonp\x22:true,\x22msgs\x22:{\x22cibl\x22:\x22Borrar búsqueda\x22,\x22dym\x22:\x22Quizás quisiste decir:\x22,\x22lcky\x22:\x22Me siento con suerte\x22,\x22lml\x22:\x22Más información\x22,\x22oskt\x22:\x22Herramientas de introducción de texto\x22,\x22psrc\x22:\x22Se ha eliminado esta búsqueda de tu \\u003Ca href\x3d\\\x22/history\\\x22\\u003EHistorial web\\u003C/a\\u003E\x22,\x22psrl\x22:\x22Eliminar\x22,\x22sbit\x22:\x22Buscar por imágenes\x22,\x22srch\x22:\x22Buscar con Google\x22},\x22ovr\x22:{},\x22pq\x22:\x22\x22,\x22refpd\x22:true,\x22rfs\x22:[],\x22sbpl\x22:24,\x22sbpr\x22:24,\x22scd\x22:10,\x22sce\x22:5,\x22stok\x22:\x22T7bIDu4TRe7ccIogkTXJr0QG_jM\x22,\x22uhde\x22:false}}';google.pmc=JSON.parse(pmc);})();</script> </body></html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
id;tipo;destino;costo del plan;costo del vuelo;cupo max;cantidad;clase viaje;estado | ||
12;p;medellin;200;20;4;1;n;abierto | ||
12;p;medellin;200;20;4;1;n;abierto | ||
12;p;medellin;200;20;4;1;n;abierto | ||
12;p;medellin;200;20;4;1;n;abierto |
Oops, something went wrong.