Skip to content

Commit d16700a

Browse files
committed
rollback changes with session and fix typo in condition
1 parent d224880 commit d16700a

File tree

5 files changed

+41
-19
lines changed

5 files changed

+41
-19
lines changed

README.rst

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,15 @@ Here's a short example of how to create a Confluence page:
5050
.. code-block:: python
5151
5252
from atlassian import Confluence
53-
53+
import requests
54+
# If you want to use a session, you can create it like this:
55+
session = requests.Session()
56+
# and pass it to the Confluence constructor
5457
confluence = Confluence(
5558
url='http://localhost:8090',
5659
username='admin',
57-
password='admin')
60+
password='admin',
61+
session=session,)
5862
5963
status = confluence.create_page(
6064
space='DEMO',
@@ -69,11 +73,14 @@ And here's another example of how to get issues from Jira using JQL Query:
6973
.. code-block:: python
7074
7175
from atlassian import Jira
76+
import requests
7277
78+
session = requests.Session()
7379
jira = Jira(
7480
url='http://localhost:8080',
7581
username='admin',
76-
password='admin')
82+
password='admin',
83+
session=session) # Optional: use a session for persistent connections
7784
JQL = 'project = DEMO AND status IN ("To Do", "In Progress") ORDER BY issuekey'
7885
data = jira.jql(JQL)
7986
print(data)
@@ -83,12 +90,14 @@ The traditional jql method is deprecated for Jira Cloud users, as Atlassian has
8390
.. code-block:: python
8491
8592
from atlassian import Jira
86-
93+
import requests
94+
session = requests.Session()
8795
jira = Jira(
8896
url='https://your-jira-instance.atlassian.net',
8997
username='[email protected]',
9098
password='your-api-token',
91-
cloud=True # Ensure this is set to True for Jira Cloud
99+
cloud=True, # Ensure this is set to True for Jira Cloud
100+
session=session # Optional: use a session for persistent connections
92101
)
93102
JQL = 'project = DEMO AND status IN ("To Do", "In Progress") ORDER BY issuekey'
94103
# Fetch issues using the new enhanced_jql method
@@ -100,11 +109,14 @@ Also, you can use the Bitbucket module e.g. for getting project list
100109
.. code-block:: python
101110
102111
from atlassian import Bitbucket
112+
import requests
103113
114+
session= requests.Session()
104115
bitbucket = Bitbucket(
105116
url='http://localhost:7990',
106117
username='admin',
107-
password='admin')
118+
password='admin',
119+
session=session)
108120
109121
data = bitbucket.project_list()
110122
print(data)
@@ -115,11 +127,12 @@ Example to get your requests:
115127
.. code-block:: python
116128
117129
from atlassian import ServiceDesk
118-
130+
import requests
119131
sd = ServiceDesk(
120132
url='http://localhost:7990',
121133
username='admin',
122-
password='admin')
134+
password='admin',
135+
session=requests.Session())
123136
124137
data = sd.get_my_customer_requests()
125138
print(data)
@@ -129,11 +142,14 @@ Using Insight (CMDB Tool for Jira):
129142
.. code-block:: python
130143
131144
from atlassian import Insight
145+
import requests
132146
147+
session = requests.Session()
133148
insight = Insight(
134149
url='http://localhost:7990',
135150
username='admin',
136-
password='admin')
151+
password='admin',
152+
session=session)
137153
138154
data = insight.get_object(88)
139155
print(data)
@@ -144,11 +160,14 @@ Using Xray (Test Management tool for Jira):
144160
.. code-block:: python
145161
146162
from atlassian import Xray
163+
import requests
147164
165+
session = requests.Session()
148166
xr = Xray(
149167
url='http://localhost:7990',
150168
username='admin',
151-
password='admin')
169+
password='admin',
170+
session=session)
152171
153172
data = xr.get_tests('TEST-001')
154173
print(data)
@@ -158,10 +177,13 @@ Using Bamboo:
158177
.. code-block:: python
159178
160179
from atlassian import Bamboo
180+
import requests
161181
182+
session = requests.Session()
162183
bamboo = Bamboo(
163184
url='http://localhost:6990/bamboo/',
164-
token="<TOKEN>")
185+
token="<TOKEN>",
186+
session=session)
165187
166188
data = bamboo.get_elastic_configurations()
167189
print(data)

atlassian/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.0.6
1+
4.0.7

atlassian/bitbucket/cloud/repositories/refs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def author(self):
122122
"""User object of the author."""
123123
if self.get_data("author")["type"] == "app_user":
124124
# If the author is an app user, return an AppUser instance
125-
return AppUser(None, self.get_data("author").get("user"), **self._new_session_args)
125+
return AppUser(None, self.get_data("author"), **self._new_session_args)
126126
return User(None, self.get_data("author"))
127127

128128

atlassian/jira.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3560,9 +3560,9 @@ def jql(
35603560
if validate_query is not None:
35613561
params["validateQuery"] = validate_query
35623562
if self.cloud:
3563-
url = self.resource_url("search")
3564-
else:
35653563
url = self.resource_url("search/jql")
3564+
else:
3565+
url = self.resource_url("search")
35663566
return self.get(url, params=params)
35673567

35683568
def enhanced_jql(
@@ -3701,10 +3701,10 @@ def jql_get_list_of_tickets(
37013701
params["expand"] = expand
37023702
if validate_query is not None:
37033703
params["validateQuery"] = validate_query
3704-
if not self.cloud:
3705-
url = self.resource_url("search")
3706-
else:
3704+
if self.cloud:
37073705
url = self.resource_url("search/jql")
3706+
else:
3707+
url = self.resource_url("search")
37083708

37093709
results: List[object] = []
37103710
while True:

atlassian/rest_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def __init__(
8383
api_root: str = "rest/api",
8484
api_version: Union[str, int] = "latest",
8585
verify_ssl: bool = True,
86-
session: Optional[requests.Session] = requests.Session(),
86+
session: Optional[requests.Session] = None,
8787
oauth: Optional[dict] = None,
8888
oauth2: Optional[dict] = None,
8989
cookies: Optional[CookieJar] = None,

0 commit comments

Comments
 (0)