{"id":16700177,"url":"https://github.com/guyzmo/pybitbucket","last_synced_at":"2026-03-17T01:45:54.291Z","repository":{"id":62578968,"uuid":"75132470","full_name":"guyzmo/pybitbucket","owner":"guyzmo","description":null,"archived":false,"fork":false,"pushed_at":"2017-04-29T22:39:26.000Z","size":339,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-25T00:42:56.242Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/guyzmo.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-29T23:40:18.000Z","updated_at":"2019-02-27T14:13:39.000Z","dependencies_parsed_at":"2022-11-03T19:35:54.471Z","dependency_job_id":null,"html_url":"https://github.com/guyzmo/pybitbucket","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guyzmo%2Fpybitbucket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guyzmo%2Fpybitbucket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guyzmo%2Fpybitbucket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guyzmo%2Fpybitbucket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guyzmo","download_url":"https://codeload.github.com/guyzmo/pybitbucket/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254522063,"owners_count":22085028,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T18:09:39.463Z","updated_at":"2026-03-17T01:45:49.273Z","avatar_url":"https://github.com/guyzmo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"=============\n PyBitbucket\n=============\n\nA Python wrapper for the Bitbucket Cloud REST API.\nThis is not known to work with Bitbucket Server,\npreviously known as Stash.\nTo start working with this library, just do: :code:`pip install pybitbucket_fork`\n\n.. image:: https://img.shields.io/pypi/v/pybitbucket_fork.svg\n    :target: https://pypi.python.org/pypi/pybitbucket_fork/0.12.0\n\n.. image:: https://img.shields.io/pypi/status/pybitbucket_fork.svg\n    :target: https://pypi.python.org/pypi/pybitbucket_fork\n\n.. image:: https://img.shields.io/pypi/pyversions/pybitbucket_fork.svg\n    :target: https://pypi.python.org/pypi/pybitbucket_fork\n\n.. image:: https://img.shields.io/pypi/l/pybitbucket_fork.svg\n    :target: https://github.com/guyzmo/pybitbucket_fork/src/master/LICENSE.txt\n\n.. image:: https://img.shields.io/pypi/dm/pybitbucket_fork.svg\n    :target: https://pypi.python.org/pypi/pybitbucket_fork\n\nThis is a fork of `pybitbucket \u003chttps://bitbucket.org/atlassian/python-bitbucket\u003e`.\n\n---------------------\nAdopting this library\n---------------------\n\nAuthenticate\n============\n\nThe :code:`Authenticator` subclasses prepare API requests with credentials.\nThe simplest case is :code:`Anonymous` which connects with no credentials.\n:code:`Anonymous` can be used with an publicly available resources.\nFor private resources,\n:code:`BasicAuthenticator` uses email, username, and password as credentials.\nIf your client application has it's own mechanisms for working with these values,\nyou can subclass the :code:`BasicAuthenticator` to provide custom behavior.\n\nTo \"plug in\" your implementation or a standard one, just do:\n\n::\n\n    bitbucket = Client(\n        BasicAuthenticator(\n            'your_username_here',\n            'your_secret_password_here',\n            'pybitbucket@mailinator.com'))\n\nIf you have enabled `two-step verification \u003chttps://confluence.atlassian.com/bitbucket/two-step-verification-777023203.html\u003e`_,\nthen you will need to use an `app password \u003chttps://developer.atlassian.com/bitbucket/api/2/reference/meta/authentication#app-pw\u003e`_ with the :code:`BasicAuthenticator`,\nnot your regular user password.\nThe :code:`OAuth2Authenticator` is intended as an example and superclass.\nIt may work for some command-line clients.\nOther clients like web applications\nwill need an appropriate implementation of :code:`obtain_authorization()`\nand perhaps may need to use a different grant types.\n\nFind Things\n===========\n\nFor example, to find all your snippets:\n\n::\n\n    for snip in Snippet.find_snippets_for_role(client=bitbucket):\n        print(snip)\n\nThe method says \"for role\" but, if not provided, it will use the default of owner.\nHence, all your snippets.\n\nIn general, finding things is done with a static find method on each type of resource.\nIf the resource is plural, like \"snippets\" above, then the find method is a generator.\nYou can use it with iterators or comprehensions.\nThe resources you can find are:\n\n* user and team\n* repository and snippet\n* pull request and comment\n* commit and build status\n* hook and branch restriction\n\nCreate Things\n=============\n\nFor example, to create a new snippet:\n\n::\n\n    snip = Snippet.create(\n        files=open_files([\"README.rst\"]),\n        payload=SnippetPayload().add_title(\"My New Snippet\"),\n        client=bitbucket)\n\nThe resources you can create are:\n\n* repository and snippet\n* pull request and comment\n* build status\n* hook and branch restriction\n\nExamine Things\n==============\n\nFor example, to examine attributes on a snippet:\n\n::\n\n    snip = Snippet.find_snippet_by_id(\"Xqoz8\", bitbucket)\n    s = '\\n'.join([\n        \"id          : {}\".format(snip.id),\n        \"is_private  : {}\".format(snip.is_private),\n        \"title       : {}\".format(snip.title),\n        \"files       : {}\".format(snip.filenames),\n        \"created_on  : {}\".format(snip.created_on),\n        \"updated_on  : {}\".format(snip.updated_on),\n        \"scm         : {}\".format(snip.scm),\n        ]) if snip else 'Snippet not found.'\n    print(s)\n\nWhat attributes are available?\nYou will not find them hardcoded in Python.\nThey are populated dynamically from the JSON response.\nYou can query the list via a convenience method:\n\n::\n\n    snip = Snippet.find_snippet_by_id(\"Xqoz8\", bitbucket)\n    print(snip.attributes())\n\nBeware. The attributes for the same resource may change depending on how you got to it.\n\nNavigate Relationships\n======================\n\nFor example, to list the commits for a snippet:\n\n::\n\n    snip = Snippet.find_snippet_by_id(\"Xqoz8\", bitbucket)\n    for commit in snip.commits():\n        print(commit)\n\nWhat relationships are available?\nYou will not find them hardcoded in Python.\nThey are populated dynamically from the JSON response.\nYou can query the list via a convenience method:\n\n::\n\n    snip = Snippet.find_snippet_by_id(\"Xqoz8\", bitbucket)\n    print(snip.relationships())\n\nJust like attributes, the relationships for the same resource may change depending on how you got to it.\nIf you need the canonical resource with all attributes, use the :code:`self()` relationship:\n\n::\n\n    snips = Snippet.find_snippets_for_role(client=bitbucket)\n    one_snip = next(snips)    # one_snip has no files relationship in this context.\n    real_snip = next(one_snip.self())\n    print(real_snip.files)\n\n----------\nDeveloping\n----------\n\nPython Virtual Environment Setup (for OS X)\n===========================================\n\nIt's not virtual like a virtual machine. More like a specialized container for a Python version and libraries.\n\n1. :code:`brew install python` This installs the latest version of Python 2.7 with a version of setuptools and pip. Unfortunately, those versions of setuptools and pip seem to be broken.\n2. :code:`pip install --upgrade --no-use-wheel setuptools`\n3. :code:`pip install --upgrade --no-use-wheel pip`\n4. :code:`pip install virtualenvwrapper`\n\nProject Setup\n=============\n\n1. Clone the repository and set it as the current working directory.\n2. *(Optional, but good practice)* Create a `virtual environment \u003chttp://docs.python-guide.org/en/latest/dev/virtualenvs/\u003e`_: :code:`mkvirtualenv python-bitbucket` Once created, use :code:`workon python-bitbucket` to restore the virtual environment.\n3. :code:`pip install -r requirements-dev.txt` Loads required libraries into the virtual environment.\n4. :code:`paver test_all` Run all the unit tests and analyze the source code.\n\n----\nTODO\n----\n\n* :code:`PUT` and :code:`DELETE` for :code:`snippet.watch` from `snippets Endpoint \u003chttps://confluence.atlassian.com/display/BITBUCKET/snippets+endpoint\u003e`_.\n* Wrap the `version 1 endpoints \u003chttps://confluence.atlassian.com/display/BITBUCKET/Version+1\u003e`_ for:\n    - groups\n    - group-privileges\n    - invitations\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguyzmo%2Fpybitbucket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguyzmo%2Fpybitbucket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguyzmo%2Fpybitbucket/lists"}