Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to push files to BitBucket with Python

Deleted user May 16, 2022

I am trying to push files to BitBucket using Python.

I am getting a message that says there is no such workspace, however there is.Screenshot 2022-05-16 at 13.48.22.pngScreenshot 2022-05-16 at 13.48.05.png

1 answer

0 votes
Craig Nodwell
Community Champion
May 16, 2022

Hi @[deleted] welcome to the community.
Have a look here:
What is a Repo Slug 

Deleted user May 16, 2022

Hi @Craig Nodwell

Thank you very much for the warm welcome and the answer. I tried a dash instead of the space, however it then gives me this error:

 

{"type": "error", "error": {"message": "No workspace with identifier 'Comma_Group'."}}
Craig Nodwell
Community Champion
May 16, 2022

Hi @[deleted] Maybe try this and then use the UUID that is returned for the workspace.
api-group-workspaces/#api-user-permissions-workspaces-get 

Deleted user May 16, 2022

Hi @Craig Nodwell when I run the code it gives me this error:

    "error": {
        "detail": "There is no API hosted at this URL.\n\nFor information about our API's, please refer to the documentation at: https://developer.atlassian.com/bitbucket/api/2/reference/",
        "message": "Resource not found"
    },
    "type": "error"
}
Craig Nodwell
Community Champion
May 16, 2022

what gets returned from this? no extras
https://api.bitbucket.org/2.0/workspaces

Craig Nodwell
Community Champion
May 16, 2022

and your string above I think your missing the users statement
https://api.bitbucket.org/2.0/users/Roa......

Deleted user May 16, 2022

I just ran the code and did not add anything except for the access token, the error I am getting is the following:

 

--------------------------------------------------------------------------- JSONDecodeError Traceback (most recent call last) <ipython-input-30-c7119a419de3> in <module> 18 19 print (response.text) ---> 20 print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": "))) ~/opt/anaconda3/lib/python3.8/json/__init__.py in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 355 parse_int is None and parse_float is None and 356 parse_constant is None and object_pairs_hook is None and not kw): --> 357 return _default_decoder.decode(s) 358 if cls is None: 359 cls = JSONDecoder ~/opt/anaconda3/lib/python3.8/json/decoder.py in decode(self, s, _w) 335 336 """ --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() 339 if end != len(s): ~/opt/anaconda3/lib/python3.8/json/decoder.py in raw_decode(self, s, idx) 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: --> 355 raise JSONDecodeError("Expecting value", s, err.value) from None 356 return obj, end JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Deleted user May 16, 2022

When I run the code with no extras I get the below error:

 

---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
<ipython-input-31-547a79bb9c9d> in <module>
     17 )
     18 
---> 19 print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))

~/opt/anaconda3/lib/python3.8/json/__init__.py in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    355             parse_int is None and parse_float is None and
    356             parse_constant is None and object_pairs_hook is None and not kw):
--> 357         return _default_decoder.decode(s)
    358     if cls is None:
    359         cls = JSONDecoder

~/opt/anaconda3/lib/python3.8/json/decoder.py in decode(self, s, _w)
    335 
    336         """
--> 337         obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    338         end = _w(s, end).end()
    339         if end != len(s):

~/opt/anaconda3/lib/python3.8/json/decoder.py in raw_decode(self, s, idx)
    353             obj, end = self.scan_once(s, idx)
    354         except StopIteration as err:
--> 355             raise JSONDecodeError("Expecting value", s, err.value) from None
    356         return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events