Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mwclient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WebU
shared
mwclient
Commits
c80c1ca8
Commit
c80c1ca8
authored
11 years ago
by
Dan Michael O. Heggø
Browse files
Options
Downloads
Plain Diff
Merge pull request #27 from kyv/master
Add support for http authentification
parents
b6de90e7
72fc49ab
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mwclient/client.py
+7
-3
7 additions, 3 deletions
mwclient/client.py
with
7 additions
and
3 deletions
mwclient/client.py
+
7
−
3
View file @
c80c1ca8
...
@@ -7,6 +7,7 @@ import random
...
@@ -7,6 +7,7 @@ import random
import
sys
import
sys
import
weakref
import
weakref
import
socket
import
socket
import
base64
try
:
try
:
import
json
import
json
...
@@ -50,14 +51,15 @@ class Site(object):
...
@@ -50,14 +51,15 @@ class Site(object):
def
__init__
(
self
,
host
,
path
=
'
/w/
'
,
ext
=
'
.php
'
,
pool
=
None
,
retry_timeout
=
30
,
def
__init__
(
self
,
host
,
path
=
'
/w/
'
,
ext
=
'
.php
'
,
pool
=
None
,
retry_timeout
=
30
,
max_retries
=
25
,
wait_callback
=
lambda
*
x
:
None
,
clients_useragent
=
None
,
max_retries
=
25
,
wait_callback
=
lambda
*
x
:
None
,
clients_useragent
=
None
,
max_lag
=
3
,
compress
=
True
,
force_login
=
True
,
do_init
=
True
):
max_lag
=
3
,
compress
=
True
,
force_login
=
True
,
do_init
=
True
,
httpauth
=
None
):
# Setup member variables
# Setup member variables
self
.
host
=
host
self
.
host
=
host
self
.
path
=
path
self
.
path
=
path
self
.
ext
=
ext
self
.
ext
=
ext
self
.
credentials
=
None
self
.
credentials
=
None
self
.
compress
=
compress
self
.
compress
=
compress
if
httpauth
:
self
.
httpauth
=
httpauth
self
.
retry_timeout
=
retry_timeout
self
.
retry_timeout
=
retry_timeout
self
.
max_retries
=
max_retries
self
.
max_retries
=
max_retries
self
.
wait_callback
=
wait_callback
self
.
wait_callback
=
wait_callback
...
@@ -220,7 +222,9 @@ class Site(object):
...
@@ -220,7 +222,9 @@ class Site(object):
headers
[
'
Content-Type
'
]
=
'
application/x-www-form-urlencoded
'
headers
[
'
Content-Type
'
]
=
'
application/x-www-form-urlencoded
'
if
self
.
compress
and
gzip
:
if
self
.
compress
and
gzip
:
headers
[
'
Accept-Encoding
'
]
=
'
gzip
'
headers
[
'
Accept-Encoding
'
]
=
'
gzip
'
if
self
.
httpauth
:
credentials
=
base64
.
encodestring
(
'
%s:%s
'
%
self
.
httpauth
).
replace
(
'
\n
'
,
''
)
headers
[
'
Authorization
'
]
=
"
Basic %s
"
%
credentials
token
=
self
.
wait_token
((
script
,
data
))
token
=
self
.
wait_token
((
script
,
data
))
while
True
:
while
True
:
try
:
try
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment