Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P82670
oauth1-owneronly.py
Active
Public
Actions
Authored by
Tgr
on Sep 6 2025, 4:39 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Project Tags
None
Referenced Files
F65974574: oauth1-owneronly.py
Sep 6 2025, 4:39 PM
2025-09-06 16:39:37 (UTC+0)
Subscribers
None
#!/usr/bin/env python
import
requests
from
requests_oauthlib
import
OAuth1
consumer_key
=
'...'
consumer_secret
=
'...'
access_token
=
'...'
access_secret
=
'...'
api_url
=
'https://test.wikipedia.org/w/api.php'
data
=
{
'action'
:
'query'
,
'format'
:
'json'
,
'meta'
:
'userinfo'
,
'assert'
:
'user'
}
headers
=
{
'User-Agent'
:
'OAuth testing (T403487)'
}
headers
[
'X-Wikimedia-Debug'
]
=
'backend=k8s-mwdebug-next'
auth
=
OAuth1
(
consumer_key
,
consumer_secret
,
access_token
,
access_secret
)
r
=
requests
.
post
(
url
=
api_url
,
data
=
data
,
auth
=
auth
,
headers
=
headers
)
print
(
r
.
text
)
print
(
r
.
headers
[
'X-Powered-By'
])
Event Timeline
Tgr
created this paste.
Sep 6 2025, 4:39 PM
2025-09-06 16:39:37 (UTC+0)
Tgr
mentioned this in
T403487: Exploratory testing on PHP 8.3 for MediaWiki authentication stack: OAuth
.
Sep 6 2025, 4:42 PM
2025-09-06 16:42:54 (UTC+0)
Log In to Comment