Skip to content

Instantly share code, notes, and snippets.

View mledoze's full-sized avatar
🦆

Mohammed Le Doze mledoze

🦆
View GitHub Profile
@mledoze
mledoze / consul
Last active January 26, 2016 14:46 — forked from stojg/consul
consul service init script for debian (support access from a docker)
#!/bin/sh
### BEGIN INIT INFO
# Provides: consul
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Short-Description: Consul service discovery framework
# Description: Healthchecks local services and registers
# them in a central consul database.
from lxml import html #pip install lxml
import requests, time, os.path, json
save_to = 'flags_new' #folder where you want to save. NO / !
temp_data, data = {}, {}
def stripper(c_name):
print('Doing: ', c_name)
page = requests.get('https://en.wikipedia.org/wiki/File:Flag_of_' + c_name + '.svg') #loads the webpage
tree = html.fromstring(page.text) #html to xpath tree