Skip to content

Commit a2d1fb8

Browse files
authored
Bitbucket Cloud: Set default url (atlassian-api#685)
* Bitbucket Cloud: Set default url Unlike the server variants, the url for the Bitbucket cloud is always the same. There is no need to write the url every time, when the Cloud class should be used. Also for new users of this library it can be confusing, where to find the Bitbucket cloud url. Therefore, this commit sets for the url parameter of the Bitbucket Cloud class to a default value. It still can be modified by giving another url as parameter (i.e. for tests) * Bitbucket Cloud: Revert examples with url * Bitbucket Cloud: Remove additional module path
1 parent 175d1f7 commit a2d1fb8

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

atlassian/bitbucket/cloud/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
class Cloud(BitbucketCloudBase):
9-
def __init__(self, url, *args, **kwargs):
9+
def __init__(self, url="https://api.bitbucket.org/", *args, **kwargs):
1010
kwargs["cloud"] = True
1111
kwargs["api_root"] = None
1212
kwargs["api_version"] = "2.0"

docs/index.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ OAuth 2.0 is also supported:
8686

8787
.. code-block:: python
8888
89-
from atlassian.bitbucket.cloud import Cloud
89+
from atlassian.bitbucket import Cloud
9090
9191
# token is a dictionary and must at least contain "access_token"
9292
# and "token_type".
@@ -95,7 +95,6 @@ OAuth 2.0 is also supported:
9595
"token": token}
9696
9797
bitbucket_cloud = Cloud(
98-
url='https://api.bitbucket.org/',
9998
oauth2=oauth2_dict)
10099
101100
# For a detailed example see bitbucket_oauth2.py in
@@ -190,16 +189,14 @@ And to Bitbucket Cloud:
190189
# Log-in with E-Mail and App password not possible.
191190
# Username can be found here: https://bitbucket.org/account/settings/
192191
193-
from atlassian.bitbucket.cloud import Cloud
192+
from atlassian.bitbucket import Cloud
194193
195194
bitbucket = Cloud(
196-
url='https://api.bitbucket.org/',
197195
username=bitbucket_email,
198196
password=bitbucket_password,
199197
cloud=True)
200198
201199
bitbucket_app_pw = Cloud(
202-
url='https://api.bitbucket.org/',
203200
username=bitbucket_username,
204201
password=bitbucket_app_password,
205202
cloud=True)

examples/bitbucket/bitbucket_cloud_oo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
from textwrap import indent
44

5-
from atlassian.bitbucket.cloud import Cloud
5+
from atlassian.bitbucket import Cloud
66

7-
cloud = Cloud(url="http://localhost:7990", username="admin", password="admin")
7+
cloud = Cloud(url="https://api.bitbucket.org/", username="admin", password="admin")
88

99
index = 0
1010
for w in cloud.workspaces.each():

examples/bitbucket/bitbucket_oauth2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# token and the available workspaces are returned.
55

66
from requests_oauthlib import OAuth2Session
7-
from atlassian.bitbucket.cloud import Cloud
7+
from atlassian.bitbucket import Cloud
88
from flask import Flask, request, redirect, session
99

1010
app = Flask(__name__)

0 commit comments

Comments
 (0)