Merge pull request #5 from eldondev/master

A couple of updates and intelligent defaults.
This commit is contained in:
Noah Levitt 2014-01-28 14:57:20 -08:00
commit f8c5a08c1b
3 changed files with 6 additions and 6 deletions

View file

@ -10,9 +10,9 @@ Install via pip from this repo.
Run Run
===== =====
"umbra" script should be in bin/. "umbra" script should be in bin/.
Currently we create a browser and navigate to a single page, load_url.py takes urls as arguments and puts them onto a rabbitmq queue
then exit. We are receiving the network events, but don't yet dump_queue.py prints resources discovered by the browser and sent over the return queue.
have anything to do with them. AMQP/RabbitMQ integration is next.
On ubuntu, rabbitmq install with `sudo apt-get install rabbitmq-server` should automatically
be set up for these three scripts to function on localhost ( the default amqp url ).

View file

@ -15,7 +15,7 @@ def print_and_ack(body, message):
print(body['url']) print(body['url'])
message.ack() message.ack()
with Connection(sys.argv[1]) as conn: with Connection(sys.argv[1] if len(sys.argv) > 1 else "amqp://guest:guest@localhost:5672//") as conn:
with conn.Consumer(requests_queue, callbacks=[print_and_ack]) as consumer: with conn.Consumer(requests_queue, callbacks=[print_and_ack]) as consumer:
while True: while True:
conn.drain_events() conn.drain_events()

View file

@ -70,7 +70,7 @@ class Umbra:
with self.browser_lock: with self.browser_lock:
self.send_command(method="Network.enable") self.send_command(method="Network.enable")
self.send_command(method="Runtime.evaluate", params={"expression":"document.location = '%s';" % url}) self.send_command(method="Page.navigate", params={"url": url})
# XXX more logic goes here # XXX more logic goes here
time.sleep(10) time.sleep(10)