Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


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
Community Members
Community Events
Community Groups

Need to fetch lines of code of a bitbucket repository using any available API and python

Hi All,


We are trying to fetch the lines of code from a bitbucket repository using python and any API available.


Till now we have tried to seek help from the following blog post - but we are facing errors while establishing the connection.


Is there any method, api, documentation from where we can fetch this data?

1 answer

1 accepted

0 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 23, 2023

Hello @kompal_sithta and thank you for reaching out to the community!

I'm afraid that currently Bitbucket Cloud does not have a built-in feature to track code statistics, like the number of lines of code in a workspace or repository, so we don't currently have an API for that particular operation. We do have an open feature request to implement this functionality, which you can access with the link below : 

I would suggest you to add your vote there, since this helps both developers and product managers to understand the interest. Also, make sure you add yourself as a watcher in case you want to receive first-hand updates from that ticket. Please note that all features are implemented with this policy in mind.

While this feature is not available, you have the option to clone the repository locally and use the following git command to get the total number of lines per repository file : 

git ls-files | xargs wc -l
      50 .gitignore
       1 fileA.txt
       1 fileB.txt
       2 fileD.txt
      98 total

Alternatively, you can also check out for available code reviews add-ons in Bitbucket's Marketplace : 

Thank you, @kompal_sithta !
Patrik S

Suggest an answer

Log in or Sign up to answer
Site Admin
AUG Leaders

Atlassian Community Events