Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14456
bug70177.py
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 22 2014, 3:36 AM
2014-11-22 03:36:46 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
bug70177.py
View Options
# -*- coding: utf-8 -*-
# Test helper for https://bugs.wikimedia.org/70177
# Fires off multiple requests to the enwiki API to parse [[en:Barack Obama]]
import
json
import
threading
import
urllib
import
urllib2
## OPTIONS ##
REQS
=
3
# Number of requests to make. Requests will be made all at once.
HOST
=
'mw1019'
# Host to target. Should be serving en.wikipedia.org vhost.
url
=
'http://
%s
/w/api.php'
%
HOST
data
=
urllib
.
urlencode
({
'action'
:
'parse'
,
'format'
:
'json'
,
'prop'
:
'limitreportdata'
,
'text'
:
urllib2
.
urlopen
(
'https://en.wikipedia.org/wiki/Barack_Obama?action=raw'
)
.
read
(),
})
headers
=
{
'Content-Type'
:
'application/x-www-form-urlencoded'
,
'Host'
:
'en.wikipedia.org'
,
}
def
do_report
():
req
=
urllib2
.
Request
(
url
,
data
,
headers
)
resp
=
json
.
load
(
urllib2
.
urlopen
(
req
))
print
'
\n
'
.
join
(
'
%(name)s
:
%(0)s
'
%
datum
for
datum
in
resp
[
'parse'
][
'limitreportdata'
]
if
'time'
in
datum
[
'name'
]
)
for
i
in
range
(
REQS
):
threading
.
Thread
(
target
=
do_report
)
.
start
()
File Metadata
Details
Attached
Mime Type
text/x-python
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
13864
Default Alt Text
bug70177.py (1 KB)
Attached To
Mode
T72177: The way LuaSandbox measures CPU time is not thread-safe
Attached
Detach File
Event Timeline
Log In to Comment