Forums

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

Bitbucket get_tags problem python

Winni_Chang October 3, 2019

hi,

 

I want to search tags from some remote repositories (https://git.XXXXX.com/projects/xxx/repos/ooo/browse), and match the tag which I want to find. Those tags are in master

so I write python as following:

-------------------------------------------------------------------------------------------

from atlassian import Bitbucket

...

bbucket = Bitbucket(url='http://localhost:80', username=username, password=password)

tag = bbucket.get_tags('xxx', 'ooo', matchTag)

...

--------------------------------------------------------------------------------------------

The first question is: I'm not sure that the "url" in Bitbucket() function has to be what kind of url? my url is right?

And the second question is: when I run this code, I'll get an error: 'unicode' object has no attribute 'get'.

 

Thanks a lot.

1 answer

1 accepted

0 votes
Answer accepted
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 3, 2019

Hello @Winni_Chang,

First of all, it looks like your question is about Bitbucket Server, not Cloud – is this correct? I believe it is mistakenly tagged with cloud and bitbucket-cloud, I'll fix the tags.

Next, I'm guessing you're trying to use atlassian-python-api module – can you confirm this? It is created and maintained by a third party, and it seems to be looked after very well.

So, following the documentation of that module, the url argument for Bitbucket object constructor is a string. According to what you described, it should be something like this:

bitbucket = Bitbucket(url='https://git.XXXXX.com', username=username, password=password)

As for the error message you mentioned, unfortunately, it is not descriptive enough to say where is it thrown from and why exactly. Is there any additional hint about the line of your code or the library code which can shed some light on this?

Here's the REST endpoint get_tag() is calling btw – might be useful for figuring out what's going on.

Hope this helps.

Cheers,
Daniil

Winni_Chang October 3, 2019

Hi Danil,

 

Thanks for your response.

Yes, my question is about Bitbucket Server, not Cloud. and yes I'm trying to use atlassian-python-api module.

oh. The url is like that. I'll try it. Thanks.

And last, the error is happened when get_tag() is calling. But maybe I know what happened about it now.

Thanks.

Winni_Chang October 3, 2019

Hi Danil,

 

Thanks a lot! I am just an idiot. I guess the url is wrong, so get_tags() function can not get anything. Then it will run 'unicode'.get() in get_tags() function. But 'unicode' type doesn't have get attribute. Thus it outputs this error.

 

I appreciate your help very much!

Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 3, 2019

Cool, I'm glad it works!
No worries, always happy to help :)

Cheers,
Daniil

Like Winni_Chang likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events