Giter VIP home page Giter VIP logo

stashy's Introduction

stashy

Python client for the Atlassian Bitbucket Server (formerly known as Stash) REST API. Supports Python 2.6, 2.7, 3.5, 3.6 and 3.7

Build Status PyPI version conda-forge

Installation

pip install stashy

Testing

tox

Usage

import stashy
stash = stashy.connect("http://localhost:7990/stash", "admin", "admin")

Examples

  • Retrieve all groups
stash.admin.groups.list()
  • Retrieve all users that match a given filter
stash.admin.users.list(filter="admin")
  • Add a user to a group
stash.admin.groups.add_user('stash-users', 'admin')
  • Iterate over all projects (that you have access to)
stash.projects.list()
  • List all the repositories in a given project
stash.projects[PROJECT].repos.list()
  • Create a pull request
list(stash.projects[PROJECT].repos[REPO].pull_requests.create('PR_TITLE', 'SOURCE_REF', 'TARGET_REF', 'PR_COMMENT', 'PR_REVIEWERS_LIST'))
  • List all the commits in a pull request
list(stash.projects[PROJECT].repos[REPO].pull_requests[PULL_REQUEST].commits())
  • List all comments of pull request
list(stash..projects[PROJECT].repos[REPO].pull_requests[PULL_REQUEST].activities(fromType='COMMENTED')))
  • Delete specific comment
stash.projects[PROJECT].repos[REPO].pull_requests[PULL_REQUEST].delete_comment(COMMENT_ID, COMMENT_VERSION)
  • Update existing comment
stash.projects[PROJECT].repos[REPO].pull_requests[PULL_REQUEST].update_comment(COMMENT_ID, COMMENT_VERSION, COMMENT_TEXT)
  • Show the diff of a pull request
stash.projects[PROJECT].repos[REPO].pull_requests[PULL_REQUEST].diff()
  • List all branch restrictions for a repo
stash.projects[PROJECT].repos[REPO].restricted.list()
  • List all branch permission entities for a repo
stash.projects[PROJECT].repos[REPO].permitted.list()

Implemented

/admin/groups [DELETE, GET, POST]
/admin/groups/add-user [POST]
/admin/groups/more-members [GET]
/admin/groups/more-non-members [GET]
/admin/groups/remove-user [POST]
/admin/users [GET, POST, DELETE, PUT]
/admin/users/add-group [POST]
/admin/users/credentials [PUT]
/admin/users/more-members [GET]
/admin/users/more-non-members [GET]
/admin/users/remove-group [POST]
/admin/permissions/groups [GET, PUT, DELETE]
/admin/permissions/groups/none [GET]
/admin/permissions/users [GET, PUT, DELETE]
/admin/permissions/users/none [GET]
/groups [GET]
/projects [POST, GET]
/projects/{projectKey} [DELETE, PUT, GET]
/projects/{projectKey}/permissions/groups [GET, PUT, DELETE]
/projects/{projectKey}/permissions/groups/none [GET]
/projects/{projectKey}/permissions/users [GET, PUT, DELETE]
/projects/{projectKey}/permissions/users/none [GET]
/projects/{projectKey}/permissions/{permission}/all [GET, POST]
/projects/{projectKey}/settings/hooks [GET]
/projects/{projectKey}/settings/hooks/{hookKey} [GET]
/projects/{projectKey}/settings/hooks/{hookKey}/enabled [PUT, DELETE]
/projects/{projectKey}/settings/hooks/{hookKey}/settings [PUT, GET]
/projects/{projectKey}/settings/pull-requests [GET, POST]
/projects/{projectKey}/repos [POST, GET]
/projects/{projectKey}/repos/{repositorySlug} [DELETE, POST, PUT, GET]
/projects/{projectKey}/repos/{repositorySlug}/branches [GET, PUT, DELETE]
/projects/{projectKey}/repos/{repositorySlug}/branches/default [GET, PUT]
/projects/{projectKey}/repos/{repositorySlug}/branches/info/{changesetId} [GET]
/projects/{projectKey}/repos/{repositorySlug}/changes [GET]
/projects/{projectKey}/repos/{repositorySlug}/commits [GET]
/projects/{projectKey}/repos/{repositorySlug}/permissions [GET, POST,DELETE]
/projects/{projectKey}/repos/{repositorySlug}/pull-requests [GET, POST]
/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId} [GET, PUT]
/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/activities [GET]
/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/decline [POST]
/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/merge [GET, POST]
/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/reopen [POST]
/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/approve [POST, DELETE]
/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/watch [POST, DELETE]
/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/changes [GET]
/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments [POST]
/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId} [PUT, DELETE]
/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/commits [GET]
/projects/{projectKey}/repos/{repositorySlug}/settings/hooks [GET]
/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey} [GET]
/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/enabled [PUT, DELETE]
/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/settings [PUT, GET]
/projects/{projectKey}/repos/{repositorySlug}/settings/pull-requests [GET, POST]
/projects/{projectKey}/repos/{repositorySlug}/tags [GET, POST, DELETE]
/users [GET]
/users/{username} [GET]
/users/{username}/repos [GET]
/build-status/1.0/commits/{commit-hash} [GET, POST]
/keys/1.0/projects/{projectKey}/ssh [GET, POST]
/keys/1.0/projects/{projectKey}/repos/{repositorySlug}/ssh [GET, POST]
/ssh/1.0/keys [GET, POST]
/sync/latest/projects/{projectKey}/repos/{repositorySlug} [POST]
sync/latest/projects/{projectKey}/repos/{repositorySlug}/synchronize [POST]

Not yet implemented

/admin/mail-server [DELETE]
/application-properties [GET]
/hooks/{hookKey}/avatar [GET]
/logs/logger/{loggerName} [GET]
/logs/logger/{loggerName}/{levelName} [PUT]
/logs/rootLogger [GET]
/logs/rootLogger/{levelName} [PUT]
/markup/preview [POST]
/profile/recent/repos [GET]
/projects/{projectKey}/avatar.png [GET, POST]
/projects/{projectKey}/repos/{repositorySlug}/recreate [POST]
/projects/{projectKey}/repos/{repositorySlug}/browse [GET]
/projects/{projectKey}/repos/{repositorySlug}/browse/{path:.*} [GET]
/projects/{projectKey}/repos/{repositorySlug}/commits/{changesetId:.*} [GET]
/projects/{projectKey}/repos/{repositorySlug}/diff/{path:.*} [GET]
/projects/{projectKey}/repos/{repositorySlug}/files [GET]
/projects/{projectKey}/repos/{repositorySlug}/files/{path:.*} [GET]
/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId} [GET]
/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/diff [GET]
/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/diff/{path:.*} [GET]
/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants [GET, DELETE, POST]
/users [PUT]
/users/credentials [PUT]
/keys/1.0/projects/{projectKey}/ssh/{keyId} [GET, DELETE]
/keys/1.0/projects/{projectKey}/repos/{repositorySlug}/ssh/{keyId} [GET, DELETE]
/ssh/1.0/keys [DELETE]
/ssh/1.0/keys/{keyId} [DELETE]
/ssh/1.0/settings [GET]

stashy's People

Contributors

ahharu avatar akhaku avatar batterseapower avatar cedricschmeits avatar chaos95 avatar cosmin avatar dependabot[bot] avatar dwdking avatar flichtenheld avatar jonathanmorley avatar jsi-p avatar marchik73 avatar mupdt avatar nicoddemus avatar noahp avatar or-else avatar owenjames16 avatar pilucca avatar rgov avatar rkorshakevich avatar robinson96 avatar scytlautomation avatar shantonusen avatar shohenshel avatar tbores avatar tomikall avatar tonytamsf avatar wlupton avatar xmj avatar yurigo79 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stashy's Issues

Add support to 'branch-utils' APIs

Some new APIs used to work with branches have been introduced (documented here)

So far, only a few methods are available:

  • List branches
  • Delete a branch
  • List branches that contain a ref

For some reason, they are in a separate namespace (/rest/branch-utils/1.0 instead of /rest/api/1.0).

Project and Repository permissions - error

Hi there,
in stashy/permissions.py (lines 127 and 161), 'revoke' apis call http post when they're supposed to call http delete

Result: 405 not allowed is thrown by Stash / Bitbucket

Listing a branch content

Hello there,

Is there any example of this API usage to list the content of a specific branch and get listing of files in each directory inside a branch ?

Thanks

TypeError trying to update project

Trying to update a project using project.update(). I'm not entirely sure what the 'project' argument is but I figured that it is either the id or the key. Neither works. Getting TypeError in both cases. Any idea?

project_id = self.connection.projects[MYKEY].get()['id']
new_description = 'testing adding description...'

Traceback (most recent call last):
  File "./stash.py", line 65, in <module>
    main()
  File "./stash.py", line 61, in main
    s.add_to_description('testing adding description...')
  File "./stash.py", line 54, in add_to_description
    self.connection.projects[MYKEY].update(project_id, description=new_description)
  File "<string>", line 2, in update
  File "build/bdist.linux-x86_64/egg/stashy/errors.py", line 53, in response_or_error
  File "build/bdist.linux-x86_64/egg/stashy/errors.py", line 35, in maybe_throw
  File "build/bdist.linux-x86_64/egg/stashy/errors.py", line 25, in __init__
TypeError: cannot concatenate 'str' and 'int' objects

get branches?

I'm having difficulty in getting a list of branch names for a given repo.

for repo in stash.repos:

	pp.pprint( repo )

	pp.pprint( stash.repos[ repo[ 'slug' ] ].get_all_branches(items=5) )

	sys.exit("done")

TypeError: the JSON object must be str, not 'bytes'

for repo in stash.repos:

	pp.pprint( repo )

	pp.pprint( stash.repos[ repo[ 'slug' ] ].branches() )

	sys.exit("done")

<generator object ResourceBase.paginate at 0x110b18a98>

What am I doing wrong?

stashy not available on PyPI

The README states that you can install stashy with pip but it doesn't seem to be available. On PyPI.

It looks like you have the majority of the things in place in order to publish it. You need to put a tag on v0.1 and point setup.py to the download url then upload it.

This would greatly improve usability and accessibility of Stashy. Thanks!

http://peterdowns.com/posts/first-time-with-pypi.html
https://python-packaging-user-guide.readthedocs.org/en/latest/tutorial.html#creating-your-own-project

pip install stashy fails for python 2.7

Stashy 0.5 version does not install with python 2.7
pip install stashy
'Collecting stashy Downloading stashy-0.5.tar.gz Complete output from command python setup.py egg_info: error in stashy setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Expected version spec in enum34 ; python_version < '3.4' at ; python_version < '3.4'

Pip Version: 9.0.1
Python Version: 2.7.10

SSH Key authentication vs Username/Password

As a user I would like to connect to the BitBucket server and retrieve all repos by using a stored SSH Key, (I suspect via a key-id), instead of username/password -- however, I can't figure out how to do that.... can you help?
For instance:

stash.connect("example.com", "admin", "password")

is shown as an example -- but what if I wanted to use an SSH Key instead?

Thanks for any/all of your help regarding this.

How does pagination work?

Apologies in advance, this is a question vs. a software issue.

How does pagination work? For example, if I'd like to see all the branches in a repo, I can make the following query, and it returns a dict with the first page of 25 results. How do I get the rest?

type(stashyinstance)
class 'stashy.client.Stash'
stashyinstance.projects['myproject'].repos['myrepo'].branches()
{dict of results goes here}

How do I get subsequent result pages?

Edit:
Actually branches() is currently broken:

projects['projectname'].repos['myrepo'].branches()

In maybe_throw
File: "stashy/errors.py"
Source:
29 | def maybe_throw(response):
30 *| if not response.ok:
31 | if response.status_code == 404:
Arguments:
response:

File "stashy/errors.py", line 30, in maybe_throw
exceptions.AttributeError, 'generator' object has no attribute 'ok'

Pull request here should resolve it:
#27

stash.admin.permissions.users.revoke returns True but does not do anything

Hello,
I am trying to remove all permissions from the user , but for some reason there is no error and effect after running the command below:

import stashy

stash = stashy.connect("***", "***", "***")

    users = stash.admin.permissions.users.revoke('dg_test')

    print users     # prints "True"

Thanks,
DG

Stashy isn't getting updated on PyPI

Stashy is a pretty handy way to interact with Stash, and I've been trying to use it as the basis for adding Stash support to https://github.com/guykisel/inline-plz. However, the version currently hosted on PyPI is very outdated, and does not contain recent bug fixes and improvements needed to make this work.

I would be quite grateful if you could update the PyPI hosted package.

Add Get and Put Functionality for "Allow Forks" Setting

I would like stashy to be able to have get and post functionality for the "allow forks" setting.

I have already added this to the local copy of stashy I work on and would like to add this to the open-source version. From my understanding, the best way to go about this is to make an issue then open a pull request, so that is how I am proceeding. Let me know if there is a better way.

New release on pip

Thank you very much for stashy! It was easy to get started and has really helped us.

Could we please get new release on pip? The last one is from Feburary 2018,
and we would like to use newer features like the support for auth tokens that were introduced later.

Thank you!

Checking All the Merged Pull Requests.

Hello All,

I wanted to know if I can see all the merged Pull request relates to a repository. Can someone tell me if there exists a function for that? or can we take it as a feature requests.

"ValueError: No JSON object could be decoded"

I am able to access my stash repo, but I am always getting this error whether I call get_commit, or browse, or files. I know I am in my repo because repo.get() works. However, I am now trying to pull json files but everytime I call browse(), I get the above error. Please help, been stuck for a long time

Drop support for python 3.3

Python 3.3 support ruins our ability to select requirements based on python version. Ironically, this means we can't choose to install the back-ported enum34 package for python versions under 3.4. When this package is installed on python 3.6, it causes significant issues.

can't create branch from tag

Since the function Repository#create_branch adds the prefix "refs/heads/%s" to the origin branch name, it's impossible to create a branch from tags

Not able to list project, Project repo's and admins

I am trying to list my project repo's but i am getting an NotFoundException
I am new to python and messing around with bitbucket to get repository/projects names and their owner details.

I am using python virtualenv to run stashy and code below to test utility

import stashy
import getpass

pswd = getpass.getpass('Password:')
stash = stashy.connect("https://bitbucket.companyname.com/stash", "username", pswd)

PROJECT=input("Enter Project Name:")
stash.projects.list()
#stash.projects[PROJECT].repos.list()
#stash.admin.users.list(filter="admin")

Exception

  File "teststashy.py", line 11, in <module>
    stash.projects.list()
  File "/home/yashwanth/.venv/BBAutomation/lib/python3.7/site-packages/stashy/helpers.py", line 107, in list
    return list(self.all())
  File "/home/yashwanth/.venv/BBAutomation/lib/python3.7/site-packages/stashy/helpers.py", line 74, in paginate
    maybe_throw(response)
  File "/home/yashwanth/.venv/BBAutomation/lib/python3.7/site-packages/stashy/errors.py", line 41, in maybe_throw
    raise NotFoundException(response)
stashy.errors.NotFoundException: Not found: https://bitbucket.companyname.com/stash/rest/api/1.0/projects

What and where am I missing?

Ability to retrieve project default permissions

I can't see a way to determine what's the "default permissions" settings in a project.
Screen Shot 2019-03-13 at 4 50 28 PM

I can see if the project is public (upper left), the user access (mid), and group access (bottom), but not the default permissions (upper right). Is that functionality implemented? Am I missing anything?

Thanks!

Pagination

Is it possible to get an example of how the pagination helper works when attempting to retrieve all branches? Still fairly new to python, and don't understand how to pass in the start.

Or, it would be great if i could set the limit value in the branch method in the return. I'm trying to not have to modify this module.

return self._client.get(self.url('/branches'+'?limit=10000'), params=params)

Running into issue when trying to make call for "/projects/{projectKey}/permissions/users [GET]"

Hi,

I am trying to make call for "/projects/{projectKey}/permissions/users" [GET], which is listed as implemented, but running into some issues. I have installed stashy in my local and I can make other calls as mentioned in example but, I am running into issues when trying to get the list of authenticated users at the project level. Can someone please let me know what is the correct call for this? I have tried following calls, but couldn't get it working.

project = stash.projects['TEST_PROJECT'].permissions()
and
project = stash.projects['TEST_PROJECT'].repos['test'].permissions()

Error for (project = stash.projects['TEST_PROJECT'].permissions())
$ ./user-audit.py
Reteriving TEST_PROJECT project from stash!
Traceback (most recent call last):
File "./user-audit.py", line 31, in
get_project()
File "./user-audit.py", line 13, in get_project
project = stash.projects['TEST_PROJECT'].permissions()
TypeError: 'ProjectPermissions' object is not callable

Error for (project = stash.projects['TEST_PROJECT'].repos['test'].permissions())
$ ./user-audit.py
Reteriving TEST_PROJECT project from stash!
Traceback (most recent call last):
File "./user-audit.py", line 31, in
get_project()
File "./user-audit.py", line 13, in get_project
project = stash.projects['TEST_PROJECT'].repos['test'].permissions()
TypeError: 'Permissions' object is not callable

'pip install stashy' fails on Windows

Pip log:

Downloading/unpacking stashy
  Getting page https://pypi.python.org/simple/stashy/
  URLs to search for versions for stashy:
  * https://pypi.python.org/simple/stashy/
  Analyzing links from page https://pypi.python.org/simple/stashy/
    Found link https://pypi.python.org/packages/source/s/stashy/stashy-0.1.tar.gz#md5=a34b25f50ed7afaca2097d2083583683 (from https://pypi.python.org/simple/stashy/), version: 0.1
  Downloading stashy-0.1.tar.gz
  Downloading from URL https://pypi.python.org/packages/source/s/stashy/stashy-0.1.tar.gz#md5=a34b25f50ed7afaca2097d2083583683 (from https://pypi.python.org/simple/stashy/)
  Running setup.py (path:c:\users\cau\appdata\local\temp\pip_build_cau\stashy\setup.py) egg_info for package stashy
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "c:\users\cau\appdata\local\temp\pip_build_cau\stashy\setup.py", line 10, in <module>
        long_description=read('README.rst'),
      File "c:\users\cau\appdata\local\temp\pip_build_cau\stashy\setup.py", line 5, in read
        return open(os.path.join(os.path.dirname(__file__), fname)).read()
    IOError: [Errno 2] No such file or directory: 'c:\\users\\cau\\appdata\\local\\temp\\pip_build_cau\\stashy\\README.rst'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "c:\users\cau\appdata\local\temp\pip_build_cau\stashy\setup.py", line 10, in <module>

    long_description=read('README.rst'),

  File "c:\users\cau\appdata\local\temp\pip_build_cau\stashy\setup.py", line 5, in read

    return open(os.path.join(os.path.dirname(__file__), fname)).read()

IOError: [Errno 2] No such file or directory: 'c:\\users\\cau\\appdata\\local\\temp\\pip_build_cau\\stashy\\README.rst'

----------------------------------------
Cleaning up...
  Removing temporary dir c:\users\cau\appdata\local\temp\pip_build_cau...
Command python setup.py egg_info failed with error code 1 in c:\users\cau\appdata\local\temp\pip_build_cau\stashy
Exception information:
Traceback (most recent call last):
  File "c:\Python27\lib\site-packages\pip\basecommand.py", line 122, in main
    status = self.run(options, args)
  File "c:\Python27\lib\site-packages\pip\commands\install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "c:\Python27\lib\site-packages\pip\req.py", line 1229, in prepare_files
    req_to_install.run_egg_info()
  File "c:\Python27\lib\site-packages\pip\req.py", line 325, in run_egg_info
    command_desc='python setup.py egg_info')
  File "c:\Python27\lib\site-packages\pip\util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in c:\users\cau\appdata\local\temp\pip_build_cau\stashy

New build hosted by pypi.

Can we get a new build pushed to pypi? Using this package right now is tough and getting a proper package posted to the public pypi server would solve a lot of issues.

cannot import name 'decorator'

Hi:
I am using Python 3.6.8. I got the error cannot import name 'decorator' when I import stashy.
Do you have any idea how to fix it?

getting connect not an attribute

running:
#!/usr/bin/python
import sys
import os
import stashy

stash = stashy.connect("https://stash.***.co.uk/projects/*REPO*", "", "")
for repo in stash.projects[sys.argv[1]].repos.list():
for url in repo["links"]["clone"]:
if (url["name"] == "ssh"):
os.system("git clone %s" % url["href"])
break
Getting
Traceback (most recent call last):
File "./stashy.py", line 4, in
import stashy
File "/stashy.py", line 6, in
stash = stashy.connect("https://stash.***.co.uk/", "", "")
AttributeError: 'module' object has no attribute 'connect'

Please help

Confused about getting list of commits

I have pulled the latest changes and am using my own Python script to work with Atlassian Stash.

When I do:

commits = stash.projects[PROJECT].repos[REPO].commits()
print commits

I get the following output:

TypeError: commits() takes at least 2 arguments (1 given)

Reading through the source it is not clear to me what argument should be given to the commits() function. I have tried several commit hashes but none of them work. Many other calls do work when I use your library, such as:

branches = stash.projects[PROJECT].repos[REPO].branches()
print branches

I was hoping you could clear this up for me. Thanks!

HTTP 405 when getting keys for a user

I am trying to use the code added in #33 (and later on add POST support to it - see https://github.com/grzegorz-dubicki/stashy/tree/more-ssh).

This code works:

print "%s" % self.bitbucket.ssh.list('gdubicki')
[{u'text': u'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEAyzlZRkspi4fTtxopqxApGymeZ3z16chlZmjEbjiYMNSPHztyf8dQmO7oPXrG+spDcBgMX3k4iLJzy/F7DFm91A4qd9xhKYeMBwYonGXtrNE(...)

..but when I am trying to use the get method directly then - perhaps because I don't know how to do it correctly - I get HTTP 405 errors:

print "%s" % self.bitbucket.ssh.get('gdubicki')
<Response [405]>

Am I doing it wrong or is it broken?

example command doens't work

list(stash.projects[PROJECT].repos[REPO].pull_requests.commits()) return an error

s = list(stash.projects[_STASH_URL_MAPS[code_base][0]].repos[_STASH_URL_MAPS[code_base][1]].pull_requests.commits())

AttributeError: 'PullRequests' object has no attribute 'commits'

Branch-permissions for Bitbucket Server

The API endpoints for the 1.0 API seem to have been removed in one of the Bitbucket Server releases. There are now a couple endpoints under the 2.0 version namespace. Is a PR supporting the new endpoints for branch permissions welcome?

Unable to retrieve commits

I am unable to retrieve commits. Can you please help me with this.

  • I am using this example
    list(stash.projects[PROJECT].repos[REPO].pull_requests.commits())
    It returns this error: AttributeError: 'PullRequests' object has no attribute 'commits'
  • I could not get this working too:
    stash.projects[PROJECT].repos[REPO].commits()

I actually want to retrieve all the commits in a repo. Can you please help me with this. Thank you.

Some user SSH public key-related methods seem not to work

(This is related to #65)

Either I don't know how to use that code or the following methods of ssh.py don't work:

Keys.getitem

print "%s" % self.bitbucket.ssh[user]

returns:

(...)
TypeError: __init__() takes exactly 4 arguments (5 given)

SshFilteredIterableResource.all and SshFilteredIterableResource.list

..with no username provided:

print "%s" % self.bitbucket.ssh.list()

and

for x in self.bitbucket.ssh.all():
        print "!!!%s" % x

..return empty list/no output, while the same with my username provided return my key.

[Feature request] audit api not listed

audit/1.0/projects/{projectKey}/events
audit/1.0/projects/{projectKey}/repos/{repositorySlug}/events

These two api not listed in README, even in 'not implemented' api list

How to override "core_api_version"?

I'd like to use other core api version like 2.0,
I tried below code, but without luck:

from stashy.client import StashClient
import stashy
StashClient.core_api_version = '2.0'
s= stashy.connect('http://git.example.com', 'admin', 'foobar')
s.admin.groups.url()

s.admin.groups.url() still returns 1.0

Documentation for update calls

I spent a while banging my head on this so it might be worth updating the documentation -
I was trying to update a project description and it was reporting no error, but was not updating the project. After some trial and error I realized my problem - I was running:
project = stash.projects.get('TEST')
project.update(description='stashy test')

when what I needed to be doing was:
project - stash.projects['TEST']
project.update(description='stashy test')

Since the get returns a dict, update is a valid command and it reports success. Inspecting the 'project' object showed the update, but of course it wasn't actually sending anything to the server. It's perfectly valid behavior, just wasn't what I was expecting based on the description in the API - an example of an update call in the docs would have saved me some puzzlement.

build notification

Can somebody give me a example of the usage if the build notification ?
I tried to call the method like this:(Is there a problem with my implementation ?)

stash.builds
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'Stash' object has no attribute 'builds'

I am expecting a replay。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.