atlassian-python-api 4.0.6__py3-none-any.whl → 4.0.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
atlassian/VERSION CHANGED
@@ -1 +1 @@
1
- 4.0.6
1
+ 4.0.7
@@ -122,7 +122,7 @@ class Branch(Ref):
122
122
  """User object of the author."""
123
123
  if self.get_data("author")["type"] == "app_user":
124
124
  # 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)
126
126
  return User(None, self.get_data("author"))
127
127
 
128
128
 
atlassian/jira.py CHANGED
@@ -748,17 +748,33 @@ class Jira(AtlassianRestAPI):
748
748
  ) -> T_resp_json:
749
749
  """
750
750
  Creates a custom field with the given name and type
751
- :param name: str - name of the custom field
752
- :param type: str, like 'com.atlassian.jira.plugin.system.customfieldtypes:textfield'
753
- :param search_key: str, like above
754
- :param description: str
751
+ This method is primarily for Jira Server/Data Center. For Jira Cloud, the
752
+ `searcher_key` is not applicable.
753
+ :param name: str - The name of the custom field (e.g., "My Custom Field"). Cannot be empty.
754
+ :param type: str, The type of the custom field, which defines its behavior.
755
+ Example: 'com.atlassian.jira.plugin.system.customfieldtypes:textfield'
756
+ :param search_key: str, (For Jira Server/DC) The searcher key to make the field searchable.
757
+ Example: 'com.atlassian.jira.plugin.system.customfieldtypes:textsearcher'
758
+ :param description: str, An optional description for the custom field.
759
+ :return: A dictionary representing the created custom field, or None if the
760
+ API returns no content. Raises HTTPError for API-level errors.
761
+ API References:
762
+ - Jira Server: https://docs.atlassian.com/software/jira/docs/api/REST/9.17.0/#api/2/field-createCustomField
763
+ - Jira Cloud: https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-fields/#api-rest-api-2-field-post
755
764
  """
756
765
  url = self.resource_url("field")
757
- data = {"name": name, "type": type}
758
- if search_key:
759
- data["search_key"] = search_key
766
+ data = {"name": name.strip(), "type": type.strip()}
767
+ if not data["name"]:
768
+ raise ValueError("The 'name' for the custom field cannot be empty.")
769
+ if not data["type"]:
770
+ raise ValueError("The 'type' for the custom field cannot be empty.")
771
+ # Add optional fields if they are provided
760
772
  if description:
761
- data["description"] = description
773
+ data["description"] = description.strip()
774
+ # The API expects 'searcherKey' (camelCase)
775
+ if search_key:
776
+ data["searcherKey"] = search_key.strip()
777
+
762
778
  return self.post(url, data=data)
763
779
 
764
780
  def get_custom_field_option_context(self, field_id: T_id, context_id: T_id) -> T_resp_json:
@@ -3560,9 +3576,9 @@ class Jira(AtlassianRestAPI):
3560
3576
  if validate_query is not None:
3561
3577
  params["validateQuery"] = validate_query
3562
3578
  if self.cloud:
3563
- url = self.resource_url("search")
3564
- else:
3565
3579
  url = self.resource_url("search/jql")
3580
+ else:
3581
+ url = self.resource_url("search")
3566
3582
  return self.get(url, params=params)
3567
3583
 
3568
3584
  def enhanced_jql(
@@ -3702,9 +3718,9 @@ class Jira(AtlassianRestAPI):
3702
3718
  if validate_query is not None:
3703
3719
  params["validateQuery"] = validate_query
3704
3720
  if self.cloud:
3705
- url = self.resource_url("search")
3706
- else:
3707
3721
  url = self.resource_url("search/jql")
3722
+ else:
3723
+ url = self.resource_url("search")
3708
3724
 
3709
3725
  results: List[object] = []
3710
3726
  while True:
atlassian/rest_client.py CHANGED
@@ -83,7 +83,7 @@ class AtlassianRestAPI(object):
83
83
  api_root: str = "rest/api",
84
84
  api_version: Union[str, int] = "latest",
85
85
  verify_ssl: bool = True,
86
- session: Optional[requests.Session] = requests.Session(),
86
+ session: Optional[requests.Session] = None,
87
87
  oauth: Optional[dict] = None,
88
88
  oauth2: Optional[dict] = None,
89
89
  cookies: Optional[CookieJar] = None,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: atlassian-python-api
3
- Version: 4.0.6
3
+ Version: 4.0.7
4
4
  Summary: Python Atlassian REST API Wrapper
5
5
  Home-page: https://github.com/atlassian-api/atlassian-python-api
6
6
  Download-URL: https://github.com/atlassian-api/atlassian-python-api
@@ -116,11 +116,15 @@ Here's a short example of how to create a Confluence page:
116
116
  .. code-block:: python
117
117
 
118
118
  from atlassian import Confluence
119
-
119
+ import requests
120
+ # If you want to use a session, you can create it like this:
121
+ session = requests.Session()
122
+ # and pass it to the Confluence constructor
120
123
  confluence = Confluence(
121
124
  url='http://localhost:8090',
122
125
  username='admin',
123
- password='admin')
126
+ password='admin',
127
+ session=session,)
124
128
 
125
129
  status = confluence.create_page(
126
130
  space='DEMO',
@@ -135,11 +139,14 @@ And here's another example of how to get issues from Jira using JQL Query:
135
139
  .. code-block:: python
136
140
 
137
141
  from atlassian import Jira
142
+ import requests
138
143
 
144
+ session = requests.Session()
139
145
  jira = Jira(
140
146
  url='http://localhost:8080',
141
147
  username='admin',
142
- password='admin')
148
+ password='admin',
149
+ session=session) # Optional: use a session for persistent connections
143
150
  JQL = 'project = DEMO AND status IN ("To Do", "In Progress") ORDER BY issuekey'
144
151
  data = jira.jql(JQL)
145
152
  print(data)
@@ -149,12 +156,14 @@ The traditional jql method is deprecated for Jira Cloud users, as Atlassian has
149
156
  .. code-block:: python
150
157
 
151
158
  from atlassian import Jira
152
-
159
+ import requests
160
+ session = requests.Session()
153
161
  jira = Jira(
154
162
  url='https://your-jira-instance.atlassian.net',
155
163
  username='your-email@example.com',
156
164
  password='your-api-token',
157
- cloud=True # Ensure this is set to True for Jira Cloud
165
+ cloud=True, # Ensure this is set to True for Jira Cloud
166
+ session=session # Optional: use a session for persistent connections
158
167
  )
159
168
  JQL = 'project = DEMO AND status IN ("To Do", "In Progress") ORDER BY issuekey'
160
169
  # Fetch issues using the new enhanced_jql method
@@ -166,11 +175,14 @@ Also, you can use the Bitbucket module e.g. for getting project list
166
175
  .. code-block:: python
167
176
 
168
177
  from atlassian import Bitbucket
178
+ import requests
169
179
 
180
+ session= requests.Session()
170
181
  bitbucket = Bitbucket(
171
182
  url='http://localhost:7990',
172
183
  username='admin',
173
- password='admin')
184
+ password='admin',
185
+ session=session)
174
186
 
175
187
  data = bitbucket.project_list()
176
188
  print(data)
@@ -181,11 +193,12 @@ Example to get your requests:
181
193
  .. code-block:: python
182
194
 
183
195
  from atlassian import ServiceDesk
184
-
196
+ import requests
185
197
  sd = ServiceDesk(
186
198
  url='http://localhost:7990',
187
199
  username='admin',
188
- password='admin')
200
+ password='admin',
201
+ session=requests.Session())
189
202
 
190
203
  data = sd.get_my_customer_requests()
191
204
  print(data)
@@ -195,11 +208,14 @@ Using Insight (CMDB Tool for Jira):
195
208
  .. code-block:: python
196
209
 
197
210
  from atlassian import Insight
211
+ import requests
198
212
 
213
+ session = requests.Session()
199
214
  insight = Insight(
200
215
  url='http://localhost:7990',
201
216
  username='admin',
202
- password='admin')
217
+ password='admin',
218
+ session=session)
203
219
 
204
220
  data = insight.get_object(88)
205
221
  print(data)
@@ -210,11 +226,14 @@ Using Xray (Test Management tool for Jira):
210
226
  .. code-block:: python
211
227
 
212
228
  from atlassian import Xray
229
+ import requests
213
230
 
231
+ session = requests.Session()
214
232
  xr = Xray(
215
233
  url='http://localhost:7990',
216
234
  username='admin',
217
- password='admin')
235
+ password='admin',
236
+ session=session)
218
237
 
219
238
  data = xr.get_tests('TEST-001')
220
239
  print(data)
@@ -224,10 +243,13 @@ Using Bamboo:
224
243
  .. code-block:: python
225
244
 
226
245
  from atlassian import Bamboo
246
+ import requests
227
247
 
248
+ session = requests.Session()
228
249
  bamboo = Bamboo(
229
250
  url='http://localhost:6990/bamboo/',
230
- token="<TOKEN>")
251
+ token="<TOKEN>",
252
+ session=session)
231
253
 
232
254
  data = bamboo.get_elastic_configurations()
233
255
  print(data)
@@ -1,4 +1,4 @@
1
- atlassian/VERSION,sha256=YMHNtaPhTP-lMMqGnKNyXk_q6TDsyXkog0aHYOdpQnA,5
1
+ atlassian/VERSION,sha256=6YO6W5P6eLz_riQiGPGqxKFSNFCIWXKIlO1Z1nj8xDk,5
2
2
  atlassian/__init__.py,sha256=CpswvfzfMsXkY0aaM-ywYqsVE82OJrLiFCFOFDTt8qI,906
3
3
  atlassian/assets.py,sha256=P3Cm9UnR1dbcoRm0uZvOnZzcY2TSxJ_iH2llYqEF7Ck,21611
4
4
  atlassian/bamboo.py,sha256=-KlqEJsMV1ZsM-em-6NmuU1JjBrO7seu07I5byus2rY,48018
@@ -6,12 +6,12 @@ atlassian/cloud_admin.py,sha256=pRLPR1-pOdvnH-H56PxtTrtW1ok_HrM2LCmvsyLlzss,4054
6
6
  atlassian/crowd.py,sha256=hsLqcmKLm-qWK3xV1pDYCeGcvUIR8k6DJkMlwcDn8QM,9255
7
7
  atlassian/errors.py,sha256=5Ob7l1ZCF2-mjejJyVt0bkvDZxoUGZVaMdLpeFxasVk,569
8
8
  atlassian/insight.py,sha256=H9ZZz73A6jXcvM2ng8Mho5jWHOljB3XIjFCki3t_6ic,23399
9
- atlassian/jira.py,sha256=wCg3uEHO09rDl_3_FqkMcLiweA18Cxk2rtsnd58pyQk,229359
9
+ atlassian/jira.py,sha256=RCOocnSxkQdq4-IJ3QXmsjbNUxbQLbcXXYOKlCR8u6Y,230622
10
10
  atlassian/marketplace.py,sha256=dLm4I8GROkdhyu3BdGtK_ssq1g44KZFi8S0HS_ZepLs,2540
11
11
  atlassian/portfolio.py,sha256=q38sFFC7DHmHM4vsFzl8sT7HcRRGKH3tT5nRlqltDzc,3696
12
12
  atlassian/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  atlassian/request_utils.py,sha256=eDWGtbbhGGoqQOqqqclaO7vuJRexzIZeTAYu7aluDuw,510
14
- atlassian/rest_client.py,sha256=V67HSgaOFcti0QYtbdeMK42Pu_kjzf-iHZoGCjH4QTs,34215
14
+ atlassian/rest_client.py,sha256=_yxs4YHBkGfcn2PSyj7ls5T1SMQPhH4TrctKajbYCGc,34201
15
15
  atlassian/service_desk.py,sha256=gPC2fehnrFvWLA-mg0Ca_l3GzHd5PG_1m7OCTApqTC8,32987
16
16
  atlassian/statuspage.py,sha256=4zXsrpPVgbaOmBoS7GBgaO389rUnuCwKeSwEVS-SFyg,93560
17
17
  atlassian/typehints.py,sha256=zmAjrhp5kjiquAEYZiv1iPXCaq5GqWYrdpLXeeILYuQ,180
@@ -37,7 +37,7 @@ atlassian/bitbucket/cloud/repositories/hooks.py,sha256=quPT8F9la2Vz5Rh-CUsUwC7V_
37
37
  atlassian/bitbucket/cloud/repositories/issues.py,sha256=rJzPfhETsI7qqi9xyo_MwaTPnwxmQe2pyBYTLyMf9Eg,5065
38
38
  atlassian/bitbucket/cloud/repositories/pipelines.py,sha256=dqGkOauMtr1Baue7ICtW7KQ0EaW-3aj2Hln3dCrFexM,9129
39
39
  atlassian/bitbucket/cloud/repositories/pullRequests.py,sha256=WQBm6gTZXTIJkypUekdBsBBA5yWlUYprWV6KxYTg2iM,16908
40
- atlassian/bitbucket/cloud/repositories/refs.py,sha256=1jMcPh03owE_NcMQXuhu0vo2h-sXyuhQaXB1DSUPvQ8,4247
40
+ atlassian/bitbucket/cloud/repositories/refs.py,sha256=bCjcPxniUXwD0YwgySoJIRnJbBBLf7J4fhwGk74aA9o,4235
41
41
  atlassian/bitbucket/cloud/repositories/repositoryVariables.py,sha256=6MAWI0vhJg71tKHVh-bfcaonXuy90lq3BEsjMl0rv2c,5088
42
42
  atlassian/bitbucket/cloud/workspaces/__init__.py,sha256=Pos5ktbVEqfcP6tTV5P-DzZL43ElDSjYT9y1CLgJnrM,5081
43
43
  atlassian/bitbucket/cloud/workspaces/members.py,sha256=fFP4ubBurFkMTDvZrQKSz5KN3cSVZnT1OBff2g8qYlE,1775
@@ -51,8 +51,8 @@ atlassian/bitbucket/server/common/permissions.py,sha256=ve-hWRIrG0zSMo1hp2uTLHGO
51
51
  atlassian/bitbucket/server/projects/__init__.py,sha256=6G3MZBOTFpwx5x3chg-M8-BbmOnrdRZiZYp2YKJScbw,7668
52
52
  atlassian/bitbucket/server/projects/repos/__init__.py,sha256=RFnZ5APax9VXASYbHbMjW12L2NR4gWbXzS-c-KyExTI,10776
53
53
  atlassian/confluence/__init__.py,sha256=rAo1C5G5kJyBwfFvMcJCVy7i7eVz10itV1dB2y0AcTA,154600
54
- atlassian_python_api-4.0.6.dist-info/licenses/LICENSE,sha256=xamAnoX0zfBamIilAfP3nSIt7dIvnj7oueX14l6uKPY,11335
55
- atlassian_python_api-4.0.6.dist-info/METADATA,sha256=pZtch3ngfxwi3m6n6asKsfoav7xxDNvute77JElLiPc,9525
56
- atlassian_python_api-4.0.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
57
- atlassian_python_api-4.0.6.dist-info/top_level.txt,sha256=84-EDv8LNaZx01TCGjBzglwPU1JSRJ7fPSq9uy55Sv0,10
58
- atlassian_python_api-4.0.6.dist-info/RECORD,,
54
+ atlassian_python_api-4.0.7.dist-info/licenses/LICENSE,sha256=xamAnoX0zfBamIilAfP3nSIt7dIvnj7oueX14l6uKPY,11335
55
+ atlassian_python_api-4.0.7.dist-info/METADATA,sha256=70iX8nwODJs4I-J9oVBOZaXK5DeBpxv-AeQwbsCDhw0,10366
56
+ atlassian_python_api-4.0.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
57
+ atlassian_python_api-4.0.7.dist-info/top_level.txt,sha256=84-EDv8LNaZx01TCGjBzglwPU1JSRJ7fPSq9uy55Sv0,10
58
+ atlassian_python_api-4.0.7.dist-info/RECORD,,