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
#!/usr/bin/env python | |
import re | |
import urllib.request | |
URL = "https://gist.githubusercontent.com/juanriaza/cafa48e8a6b87e805cb3/raw/a937cecf644ebbf0dd3f7d021e9879b26ac088e2/trash.txt" | |
print(sum(map(int, re.sub(r"\D", r"", urllib.request.urlopen(URL).read().decode())))) |
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
#!/usr/bin/env python | |
import urllib.request | |
URL = "https://gist.githubusercontent.com/juanriaza/cafa48e8a6b87e805cb3/raw/a937cecf644ebbf0dd3f7d021e9879b26ac088e2/trash.txt" | |
def es_digito(num): | |
return num in "0123456789" |
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
#!/usr/bin/env python | |
""" | |
Objetivo ....: Mostrar por pantalla el resultado de sumar | |
todos los digitos contenidos en el fichero | |
remoto apuntado por la variable URL (ubicada en | |
el modulo 'config') | |
Pistas ......: int() y list() | |
Sugerencias .: map() y filter() |
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
3-0:]|_3]220()3[31:6_75)[940-_87::[8_].7_:-)(6)21_.9144202(6.-]64[_]3][_2(]37)1[3.8344(65[61:_019_1]_0]()54.7)513]:..)2527071-(3)3)6:)].5[(:81]5)-44[_7(_1_384]:|_0-]|0-(7].2)|_13.(5-|||0(4|].13]4[.0]20|3.]26547[]5||22)-.58]5012|3.3:3]61):856:)])699753[-483606:421)|:._565(5]|8705.7(0964--.-300]:975.44--]-70)33(40-]|-2:_)]8[:2_-185|310])([:8(.6_85.|2|34])08]071|_835[0[-3]696|.:0:(_04.14459).2_67_[9-.[(]0(|36799)320[[(]7)6]0]|[0[[:6(1]--6979.]81_08:2_335_..82)[[__9(7|]9].766|326790-55[8.272_]37:|::(:8554(91|4_9)9-29)_.-9)7|.-.])((:364-8(8868|9)86]|[40__70(426[8(8-:|8--9:6|8-(8_][]5(_--:4:[2620[13|.87:.]-20_2|5--7.-9-[1(2-88564(-2.)4.:8..(-95|[2[0205(||2(:8_)0)66:_8_:92|29:_7-_[[4](3(1-96(.|)(07[5_:(07)2-.)()(42|29.|04.0-6)502|3_|)3|90.7[-)7[.5-0401-|[7:)0:94)1[710)9:33)_|3-)5:[(|736036|7[5883]3--||7.[.7276(92-7986.7(((-_|4726]|([.()-7)0:6(9-111_7||[4)9144[|130137]:80.2|:(_]3[9(3-15-)0.9).043:05_8(:_).|01(_1:418]59]50)0.1_)2--9:636|[71891-(2(622.](79-|([05).7-:99()][8:.652(169]|5500.7(.:1|)])3_--._2)[)8006.]7(]0[ |
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
#!/usr/bin/env python | |
def leer_fichero(nombre_fichero): | |
fichero = open(nombre_fichero) | |
contenido = fichero.read() | |
fichero.close() | |
return contenido | |
# |
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
# -*- coding: utf-8 -*- | |
import requests | |
from mutagen import mp3, id3 | |
req = requests.get( | |
'https://api.hypem.com/v2/users/juanriaza/favorites', | |
params={'count': 500, 'key': 'e51d64cf4ff893dfca4e2b5caa60bd21'}) | |
if req.ok: | |
for song in req.json(): |
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
# -*- coding: utf-8 -*- | |
from __future__ import absolute_import | |
import os | |
from scrapy.contrib.httpcache import FilesystemCacheStorage | |
from .dupefilter import splash_requst_fingerprint | |
class SplashAwareFSCacheStorage(FilesystemCacheStorage): | |
def _get_request_path(self, spider, request): |
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 requests | |
mobile_code = 'XXXX' | |
req = requests.post('https://mobile.librecon.io/secret/api/v1/auth/code', data={'code': mobile_code}) | |
auth_hash = req.json()['data']['assistant']['hash'] | |
""" | |
{u'data': {u'assistant': {u'address': u'---', | |
u'cellPhone': u'---', | |
u'company': u'Scrapinghub', | |
u'country': u'SPAIN', |
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
"""XPath extension functions for lxml, inspired by: | |
https://gist.github.com/shirk3y/458224083ce5464627bc | |
Usage: | |
import xpathfuncs; xpathfuncs.setup() | |
""" | |
import string |
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
{ | |
"sessionId": "JoR1O6xasLEdZz8XGRtsvw__.oses4083-atg05", | |
"statusCode": "0", | |
"statusMessage": "The API Get Item by Id was executed successfully", | |
"errors": [], | |
"items": [ | |
{ | |
"deptId": "1215352562047", | |
"deptName": "Spirits & Alcopops", | |
"weight": "250ML", |