My favorites | Sign in
Project Home Downloads Wiki Issues Source
Repository:
Checkout   Browse   Changes   Clones    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/python

import time
import urllib
import urllib2

DRYRUN=0
SKIP=0
FILE = file('dict/data.adv')
N = 20
VERSION = -1
URL = 'http://localhost:8080/_ah/wordly/upload/'
#URL = 'http://wordlybot.appspot.com/_ah/wordly/upload/'

def TakeN(n, iterator):
while n > 0:
for i in iterator:
yield i
break
n -= 1


count = 0
while True:
lines = ''.join(TakeN(N, FILE))
if not lines:
break
count += N
if count < SKIP:
continue
start = time.time()
result = urllib2.urlopen(
URL, urllib.urlencode({'body': lines, 'dryrun': DRYRUN}))
for result_line in result:
pass
#print result_line
result.close()
end = time.time()
if end - start < 1.0:
time.sleep(1.0 - end + start)
print count
print 'Done!'

Change log

fd8353b6634b by Logan Hanks <logan.hanks> on Sep 23, 2009   Diff
Implemented very crude garbage collection
task.
Go to: 
Project members, sign in to write a code review

Older revisions

4459083676df by Logan Hanks <logan.hanks> on Sep 21, 2009   Diff
Very crude but mostly functional
prototype.
All revisions of this file

File info

Size: 760 bytes, 43 lines
Powered by Google Project Hosting