|
|
|
@ -8,14 +8,14 @@ import json |
|
|
|
import requests |
|
|
|
import requests |
|
|
|
from sshtunnel import open_tunnel |
|
|
|
from sshtunnel import open_tunnel |
|
|
|
import paramiko |
|
|
|
import paramiko |
|
|
|
|
|
|
|
from getpass import getpass |
|
|
|
|
|
|
|
import arangodb |
|
|
|
|
|
|
|
import config |
|
|
|
|
|
|
|
from helpers import now |
|
|
|
|
|
|
|
|
|
|
|
# Gör fb-scraper till arbetsmapp |
|
|
|
# Gör fb-scraper till arbetsmapp |
|
|
|
chdir(dirname(dirname(abspath(__file__)))) |
|
|
|
chdir(dirname(dirname(abspath(__file__)))) |
|
|
|
|
|
|
|
|
|
|
|
from arangodb import arango_connect |
|
|
|
|
|
|
|
import config |
|
|
|
|
|
|
|
from helpers import now, nowstamp |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def mullvad_servers_to_db(db): |
|
|
|
def mullvad_servers_to_db(db): |
|
|
|
"""Läser fil med servarar och exporterar till db. Används bara om servarna skulle uppdateras hos Mullvad.""" |
|
|
|
"""Läser fil med servarar och exporterar till db. Används bara om servarna skulle uppdateras hos Mullvad.""" |
|
|
|
@ -226,9 +226,6 @@ if __name__ == "__main__": |
|
|
|
#'159': {'info': 'login:password:birthday:id:cookie', 'sep':':' |
|
|
|
#'159': {'info': 'login:password:birthday:id:cookie', 'sep':':' |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pwd = "concert-hangar-mirth-salk-DECAL" |
|
|
|
|
|
|
|
db = arango_connect(pwd, username="Accs") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
############################### |
|
|
|
############################### |
|
|
|
### Variabler att ställa in ### |
|
|
|
### Variabler att ställa in ### |
|
|
|
country = "us" |
|
|
|
country = "us" |
|
|
|
@ -238,11 +235,11 @@ if __name__ == "__main__": |
|
|
|
|
|
|
|
|
|
|
|
accs = "accs" |
|
|
|
accs = "accs" |
|
|
|
|
|
|
|
|
|
|
|
vendor = str(file[file.rfind('-')+1:file.rfind('.')]) |
|
|
|
file = input("Lägg filen här ").strip("'").strip() |
|
|
|
sep = vendors[vendor]['sep'] |
|
|
|
vendor = str(file[file.rfind("-") + 1 : file.rfind(".")]) |
|
|
|
info = vendors[vendor]['info'].split(':') |
|
|
|
sep = vendors[vendor]["sep"] |
|
|
|
|
|
|
|
info = vendors[vendor]["info"].split(":") |
|
|
|
|
|
|
|
|
|
|
|
file = input('Lägg filen här ').strip("'").strip() |
|
|
|
|
|
|
|
data = [] |
|
|
|
data = [] |
|
|
|
with open(file) as document: |
|
|
|
with open(file) as document: |
|
|
|
for row in document: |
|
|
|
for row in document: |
|
|
|
@ -250,6 +247,8 @@ if __name__ == "__main__": |
|
|
|
data.append(row.split(sep)) |
|
|
|
data.append(row.split(sep)) |
|
|
|
|
|
|
|
|
|
|
|
# Lägg in i accs |
|
|
|
# Lägg in i accs |
|
|
|
|
|
|
|
# Öppna SSH-tunnel till RBP/db. |
|
|
|
|
|
|
|
pwd_key = getpass("Password for rsa-key: ") |
|
|
|
with open_tunnel( |
|
|
|
with open_tunnel( |
|
|
|
("studio-garda.asuscomm.com", 2200), |
|
|
|
("studio-garda.asuscomm.com", 2200), |
|
|
|
ssh_username="Lasse", |
|
|
|
ssh_username="Lasse", |
|
|
|
@ -259,9 +258,13 @@ if __name__ == "__main__": |
|
|
|
ssh_private_key_password=pwd_key, |
|
|
|
ssh_private_key_password=pwd_key, |
|
|
|
remote_bind_address=("127.0.0.1", 8529), |
|
|
|
remote_bind_address=("127.0.0.1", 8529), |
|
|
|
) as server: |
|
|
|
) as server: |
|
|
|
# server.start() |
|
|
|
|
|
|
|
port_arango = server.local_bind_port |
|
|
|
port_arango = server.local_bind_port |
|
|
|
to_accs(db, data, info, profiles, vendor) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Ta bort dokumentet med data |
|
|
|
db = arangodb.arango_connect( |
|
|
|
# db.collection('from_market').delete(i['_key'], silent=True, ignore_missing=True) |
|
|
|
"concert-hangar-mirth-salk-DECAL", |
|
|
|
|
|
|
|
username="Accs", |
|
|
|
|
|
|
|
host_arango="http://127.0.0.1", |
|
|
|
|
|
|
|
port_arango=port_arango, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
to_accs(db, data, info, profiles, vendor) |
|
|
|
|