You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
855 B
40 lines
855 B
from sys import argv |
|
from time import sleep |
|
import requests |
|
from arango import ArangoClient |
|
|
|
# Info för arangodb |
|
user_arango = "Phone" |
|
db_arango = "facebook" |
|
host_arango = "http://192.168.1.10:8529" |
|
|
|
# Starta koppling till arangodb |
|
|
|
db = ArangoClient(hosts=host_arango).db( |
|
db_arango, username=user_arango, password=argv[1] |
|
) |
|
|
|
phone = db.collection("phone") |
|
|
|
while True: |
|
cursor = db.aql.execute( |
|
""" |
|
for doc in phone |
|
filter doc.personal_number == 'get four last' |
|
limit 1 |
|
return doc |
|
""" |
|
) |
|
|
|
try: |
|
doc = [i for i in cursor][0] |
|
except IndexError: |
|
sleep(60) |
|
|
|
url = doc['four_last_url'] |
|
|
|
four_last = requests.get(url).text |
|
|
|
doc['personal_number'] = str(doc['date_of_birth']) + '-' + four_last |
|
print(doc) |
|
phone.update(doc) |