Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,299,974
Community Members
 
Community Events
165
Community Groups

How to push files to BitBucket with Python

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 Leader May 16, 2022

Hi @Roan van Heerden welcome to the community.
Have a look here:
What is a Repo Slug 

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 Leader May 16, 2022

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

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 Leader May 16, 2022

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

Craig Nodwell Community Leader May 16, 2022

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

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)

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
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,248 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you