parent
5b88446c14
commit
d840baa435
3 changed files with 52 additions and 4 deletions
@ -0,0 +1,40 @@ |
|||||||
|
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) |
||||||
Loading…
Reference in new issue