python-bitbucket-0.1/0000755000175000017500000000000011703371617013727 5ustar piotrpiotrpython-bitbucket-0.1/setup.cfg0000644000175000017500000000003311703371617015544 0ustar piotrpiotr[egg_info] tag_build = dev python-bitbucket-0.1/.gitignore0000644000175000017500000000006611703371617015721 0ustar piotrpiotr*.pyc *.swp *.swo *.egg-info* docs/_build* build dist python-bitbucket-0.1/tests/0000755000175000017500000000000011703371617015071 5ustar piotrpiotrpython-bitbucket-0.1/tests/pythonbitbucket.py0000644000175000017500000000033211703371617020657 0ustar piotrpiotr#!/usr/bin/env python # -*- coding: utf-8 -*- """pythonbitbucket tests.""" from unittest import TestCase class pythonbitbucketTest(TestCase): def setUp(self): pass def tearDown(self): pass python-bitbucket-0.1/tests/__init__.py0000644000175000017500000000000011703371617017170 0ustar piotrpiotrpython-bitbucket-0.1/bitbucket/0000755000175000017500000000000011703371617015703 5ustar piotrpiotrpython-bitbucket-0.1/bitbucket/api.py0000644000175000017500000002100211703371617017021 0ustar piotrpiotr#!/usr/bin/env python # -*- coding: utf-8 -*- """Bitbucket API wrapper. Written to be somewhat like py-github: https://github.com/dustin/py-github """ from urllib2 import Request, urlopen, URLError from urllib import urlencode from functools import wraps import datetime import time try: import json except ImportError: import simplejson as json __all__ = ['AuthenticationRequired', 'to_datetime', 'BitBucket'] api_base = 'https://api.bitbucket.org/1.0/' api_toplevel = 'https://api.bitbucket.org/' class AuthenticationRequired(Exception): pass def requires_authentication(method): @wraps(method) def wrapper(self, *args, **kwargs): username = self.bb.username if hasattr(self, 'bb') else self.username password = self.bb.password if hasattr(self, 'bb') else self.password if not all((username, password)): raise AuthenticationRequired("%s requires authentication" % method.__name__) return method(self, *args, **kwargs) return wrapper def smart_encode(**kwargs): """Urlencode's provided keyword arguments. If any kwargs are None, it does not include those.""" args = dict(kwargs) for k,v in args.items(): if v is None: del args[k] if not args: return '' return urlencode(args) def to_datetime(timestring): """Convert one of the bitbucket API's timestamps to a datetime object.""" format = '%Y-%m-%d %H:%M:%S' return datetime.datetime(*time.strptime(timestring, format)[:7]) class BitBucket(object): """Main bitbucket class. Use an instantiated version of this class to make calls against the REST API.""" def __init__(self, username='', password=''): self.username = username self.password = password # extended API support def build_request(self, url, data=None): if not all((self.username, self.password)): return Request(url,data) auth = '%s:%s' % (self.username, self.password) auth = {'Authorization': 'Basic %s' % (auth.encode('base64').strip())} if data and not isinstance(data, (str, unicode)): data = urlencode(data) return Request(url, data, auth) def load_url(self, url, quiet=False, method=None, data=None): request = self.build_request(url,data) if method: request.get_method = lambda : method try: result = urlopen(request).read() except: if not quiet: import traceback traceback.print_exc() print "url was: %s" % url result = "[]" return result def user(self, username): return User(self, username) def repository(self, username, slug): return Repository(self, username, slug) @property @requires_authentication def ssh_keys(self): return SSHKeys(self) @requires_authentication def new_repository(self,name,**data): """Create a new repository with the given name for the authenticated user. Return a Repository object """ url = api_base + 'repositories/' data['name'] = name response = json.loads(self.load_url(url,data=data)) if 'slug' in response: return self.repository(self.username,response['slug']) @requires_authentication def remove_repository(self,slug): """Given a slug, remove a repository from the authenticated user""" url = api_base + 'repositories/%s/%s' % (self.username,slug) method = 'DELETE' self.load_url(url,method=method) return True @requires_authentication def emails(self): """Returns a list of configured email addresses for the authenticated user.""" url = api_base + 'emails/' return json.loads(self.load_url(url)) def __repr__(self): extra = '' if all((self.username, self.password)): extra = ' (auth: %s)' % self.username return '' % extra class User(object): """API encapsulation for user related bitbucket queries.""" def __init__(self, bb, username): self.bb = bb self.username = username def repository(self, slug): return Repository(self.bb, self.username, slug) def repositories(self): user_data = self.get() return user_data['repositories'] def events(self, start=None, limit=None): query = smart_encode(start=start, limit=limit) url = api_base + 'users/%s/events/' % self.username if query: url += '?%s' % query return json.loads(self.bb.load_url(url)) def get(self): url = api_base + 'users/%s/' % self.username return json.loads(self.bb.load_url(url)) def __repr__(self): return '' % self.username class Repository(object): def __init__(self, bb, username, slug): self.bb = bb self.username = username self.slug = slug self.base_url = api_base + 'repositories/%s/%s/' % (self.username, self.slug) def get(self): return json.loads(self.bb.load_url(self.base_url)) def changeset(self, revision): """Get one changeset from a repos.""" url = self.base_url + 'changesets/%s/' % (revision) return json.loads(self.bb.load_url(url)) def changesets(self, limit=None): """Get information about changesets on a repository.""" url = self.base_url + 'changesets/' query = smart_encode(limit=limit) if query: url += '?%s' % query return json.loads(self.bb.load_url(url, quiet=True)) def tags(self): """Get a list of tags for a repository.""" url = self.base_url + 'tags/' return json.loads(self.bb.load_url(url)) def branches(self): """Get a list of branches for a repository.""" url = self.base_url + 'branches/' return json.loads(self.bb.load_url(url)) def issue(self, number): return Issue(self.bb, self.username, self.slug, number) def issues(self, start=None, limit=None): url = self.base_url + 'issues/' query = smart_encode(start=start, limit=limit) if query: url += '?%s' % query return json.loads(self.bb.load_url(url)) def events(self): url = self.base_url + 'events/' return json.loads(self.bb.load_url(url)) def followers(self): url = self.base_url + 'followers/' return json.loads(self.bb.load_url(url)) @requires_authentication def services(self): url = self.base_url + 'services/' return json.loads(self.bb.load_url(url)) @requires_authentication def new_service(self, **data): url = self.base_url + 'services/' return json.loads(self.bb.load_url(url, method="POST", data=data)) @requires_authentication def privileges(self): url = api_base + 'privileges/%s/%s' % (self.username, self.slug) return json.loads(self.bb.load_url(url)) @requires_authentication def set_privilege(self, user, privilege): url = api_base + 'privileges/%s/%s/%s/' % (self.username, self.slug, user) return json.loads(self.bb.load_url(url, method="PUT", data=privilege)) def __repr__(self): return '' % (self.username, self.slug) class Issue(object): def __init__(self, bb, username, slug, number): self.bb = bb self.username = username self.slug = slug self.number = number self.base_url = api_base + 'repositories/%s/%s/issues/%s/' % (username, slug, number) def get(self): return json.loads(self.bb.load_url(self.base_url)) def followers(self): url = self.base_url + 'followers/' return json.loads(self.bb.load_url(url)) def __repr__(self): return '' % (self.number, self.username, self.slug) class SSHKeys(object): def __init__(self, bb): self.bb = bb def _url(self, subPath=None): _url = r"https://api.bitbucket.org/1.0/ssh-keys/" if subPath: _url += subPath.strip("/") _url += "/" return _url def get(self): return json.loads(self.bb.load_url(self._url())) def delete(self, pk): _pk = int(pk) # Key ID has to be integer return self.bb.load_url( self._url(str(_pk)), method="DELETE", ) def add(self, key): return json.loads(self.bb.load_url( self._url(), method="POST", data={"key": key}, )) python-bitbucket-0.1/bitbucket/__init__.py0000644000175000017500000000004411703371617020012 0ustar piotrpiotr VERSION = "0.1" from api import * python-bitbucket-0.1/docs/0000755000175000017500000000000011703371617014657 5ustar piotrpiotrpython-bitbucket-0.1/docs/index.rst0000644000175000017500000000104511703371617016520 0ustar piotrpiotr.. python-bitbucket documentation master file, created by sphinx-quickstart. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. python-bitbucket ----------- .. automodule:: python-bitbucket .. highlight:: sh You can install python-bitbucket with pip:: pip install python-bitbucket You can fork python-bitbucket `from its hg repository `_:: hg clone http://bitbucket.org/jmoiron/python-bitbucket/ .. highlight:: python python-bitbucket-0.1/docs/_theme/0000755000175000017500000000000011703371617016120 5ustar piotrpiotrpython-bitbucket-0.1/docs/_theme/nature/0000755000175000017500000000000011703371617017416 5ustar piotrpiotrpython-bitbucket-0.1/docs/_theme/nature/theme.conf0000644000175000017500000000010711703371617021365 0ustar piotrpiotr[theme] inherit = basic stylesheet = nature.css pygments_style = tango python-bitbucket-0.1/docs/_theme/nature/static/0000755000175000017500000000000011703371617020705 5ustar piotrpiotrpython-bitbucket-0.1/docs/_theme/nature/static/nature.css_t0000644000175000017500000000741411703371617023246 0ustar piotrpiotr/** * Sphinx stylesheet -- default theme * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ @import url("basic.css"); /* -- page layout ----------------------------------------------------------- */ body { font-family: Arial, sans-serif; font-size: 100%; background-color: #111111; color: #555555; margin: 0; padding: 0; } div.documentwrapper { float: left; width: 100%; } div.bodywrapper { margin: 0 0 0 300px; } hr{ border: 1px solid #B1B4B6; } div.document { background-color: #fafafa; } div.body { background-color: #ffffff; color: #3E4349; padding: 1em 30px 30px 30px; font-size: 0.9em; } div.footer { color: #555; width: 100%; padding: 13px 0; text-align: center; font-size: 75%; } div.footer a { color: #444444; } div.related { background-color: #6BA81E; line-height: 36px; color: #ffffff; text-shadow: 0px 1px 0 #444444; font-size: 1.1em; } div.related a { color: #E2F3CC; } div.related .right { font-size: 0.9em; } div.sphinxsidebar { font-size: 0.9em; line-height: 1.5em; width: 300px } div.sphinxsidebarwrapper{ padding: 20px 0; } div.sphinxsidebar h3, div.sphinxsidebar h4 { font-family: Arial, sans-serif; color: #222222; font-size: 1.2em; font-weight: bold; margin: 0; padding: 5px 10px; text-shadow: 1px 1px 0 white } div.sphinxsidebar h3 a { color: #444444; } div.sphinxsidebar p { color: #888888; padding: 5px 20px; margin: 0.5em 0px; } div.sphinxsidebar p.topless { } div.sphinxsidebar ul { margin: 10px 10px 10px 20px; padding: 0; color: #000000; } div.sphinxsidebar a { color: #444444; } div.sphinxsidebar a:hover { color: #E32E00; } div.sphinxsidebar input { border: 1px solid #cccccc; font-family: sans-serif; font-size: 1.1em; padding: 0.15em 0.3em; } div.sphinxsidebar input[type=text]{ margin-left: 20px; } /* -- body styles ----------------------------------------------------------- */ a { color: #005B81; text-decoration: none; } a:hover { color: #E32E00; } div.body h1, div.body h2, div.body h3, div.body h4, div.body h5, div.body h6 { font-family: Arial, sans-serif; font-weight: normal; color: #212224; margin: 30px 0px 10px 0px; padding: 5px 0 5px 0px; text-shadow: 0px 1px 0 white; border-bottom: 1px solid #C8D5E3; } div.body h1 { margin-top: 0; font-size: 200%; } div.body h2 { font-size: 150%; } div.body h3 { font-size: 120%; } div.body h4 { font-size: 110%; } div.body h5 { font-size: 100%; } div.body h6 { font-size: 100%; } a.headerlink { color: #c60f0f; font-size: 0.8em; padding: 0 4px 0 4px; text-decoration: none; } a.headerlink:hover { background-color: #c60f0f; color: white; } div.body p, div.body dd, div.body li { line-height: 1.8em; } div.admonition p.admonition-title + p { display: inline; } div.highlight{ background-color: white; } div.note { background-color: #eeeeee; border: 1px solid #cccccc; } div.seealso { background-color: #ffffcc; border: 1px solid #ffff66; } div.topic { background-color: #fafafa; border-width: 0; } div.warning { background-color: #ffe4e4; border: 1px solid #ff6666; } p.admonition-title { display: inline; } p.admonition-title:after { content: ":"; } pre { padding: 10px; background-color: #fafafa; color: #222222; line-height: 1.5em; font-size: 1.1em; margin: 1.5em 0 1.5em 0; -webkit-box-shadow: 0px 0px 4px #d8d8d8; -moz-box-shadow: 0px 0px 4px #d8d8d8; box-shadow: 0px 0px 4px #d8d8d8; } tt { color: #222222; padding: 1px 2px; font-size: 1.2em; font-family: monospace; } #table-of-contents ul { padding-left: 2em; } python-bitbucket-0.1/docs/_theme/nature/static/pygments.css0000644000175000017500000000523511703371617023272 0ustar piotrpiotr.c { color: #999988; font-style: italic } /* Comment */ .k { font-weight: bold } /* Keyword */ .o { font-weight: bold } /* Operator */ .cm { color: #999988; font-style: italic } /* Comment.Multiline */ .cp { color: #999999; font-weight: bold } /* Comment.preproc */ .c1 { color: #999988; font-style: italic } /* Comment.Single */ .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .ge { font-style: italic } /* Generic.Emph */ .gr { color: #aa0000 } /* Generic.Error */ .gh { color: #999999 } /* Generic.Heading */ .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .go { color: #111 } /* Generic.Output */ .gp { color: #555555 } /* Generic.Prompt */ .gs { font-weight: bold } /* Generic.Strong */ .gu { color: #aaaaaa } /* Generic.Subheading */ .gt { color: #aa0000 } /* Generic.Traceback */ .kc { font-weight: bold } /* Keyword.Constant */ .kd { font-weight: bold } /* Keyword.Declaration */ .kp { font-weight: bold } /* Keyword.Pseudo */ .kr { font-weight: bold } /* Keyword.Reserved */ .kt { color: #445588; font-weight: bold } /* Keyword.Type */ .m { color: #009999 } /* Literal.Number */ .s { color: #bb8844 } /* Literal.String */ .na { color: #008080 } /* Name.Attribute */ .nb { color: #999999 } /* Name.Builtin */ .nc { color: #445588; font-weight: bold } /* Name.Class */ .no { color: #ff99ff } /* Name.Constant */ .ni { color: #800080 } /* Name.Entity */ .ne { color: #990000; font-weight: bold } /* Name.Exception */ .nf { color: #990000; font-weight: bold } /* Name.Function */ .nn { color: #555555 } /* Name.Namespace */ .nt { color: #000080 } /* Name.Tag */ .nv { color: purple } /* Name.Variable */ .ow { font-weight: bold } /* Operator.Word */ .mf { color: #009999 } /* Literal.Number.Float */ .mh { color: #009999 } /* Literal.Number.Hex */ .mi { color: #009999 } /* Literal.Number.Integer */ .mo { color: #009999 } /* Literal.Number.Oct */ .sb { color: #bb8844 } /* Literal.String.Backtick */ .sc { color: #bb8844 } /* Literal.String.Char */ .sd { color: #bb8844 } /* Literal.String.Doc */ .s2 { color: #bb8844 } /* Literal.String.Double */ .se { color: #bb8844 } /* Literal.String.Escape */ .sh { color: #bb8844 } /* Literal.String.Heredoc */ .si { color: #bb8844 } /* Literal.String.Interpol */ .sx { color: #bb8844 } /* Literal.String.Other */ .sr { color: #808000 } /* Literal.String.Regex */ .s1 { color: #bb8844 } /* Literal.String.Single */ .ss { color: #bb8844 } /* Literal.String.Symbol */ .bp { color: #999999 } /* Name.Builtin.Pseudo */ .vc { color: #ff99ff } /* Name.Variable.Class */ .vg { color: #ff99ff } /* Name.Variable.Global */ .vi { color: #ff99ff } /* Name.Variable.Instance */ .il { color: #009999 } /* Literal.Number.Integer.Long */python-bitbucket-0.1/docs/conf.py0000644000175000017500000001331711703371617016163 0ustar piotrpiotr# -*- coding: utf-8 -*- # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys, os from datetime import datetime # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. projpath = os.path.abspath('..') sys.path.append(projpath) # -- General configuration ----------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8' # The master toctree document. master_doc = 'index' # General information about the project. project = 'python-bitbucket' copyright = u'2010 Jason Moiron' # The short X.Y version. version = '0.1' # The full version, including alpha/beta/rc tags. version = None for line in open(os.path.join(projpath, 'setup.py'), 'r'): if line.startswith('version'): exec line if version is None: version = '0.1' # The full version, including alpha/beta/rc tags. release = version print ("Building release: %s, version: %s" % (release, version)) # List of documents that shouldn't be included in the build. #unused_docs = [] # List of directories, relative to source directory, that shouldn't be searched # for source files. exclude_trees = ['_build'] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. #html_theme = 'default' html_theme = 'nature' html_theme_path = ['_theme'] #html_theme_options = {} # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_use_modindex = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = '' # Output file base name for HTML help builder. htmlhelp_basename = 'python-bitbucketdoc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'python-bitbucket.tex', u'python-bitbucket Documentation', u'Jason Moiron', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # Additional stuff for the LaTeX preamble. #latex_preamble = '' # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_use_modindex = True python-bitbucket-0.1/docs/Makefile0000644000175000017500000000664711703371617016334 0ustar piotrpiotr# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest distro zip help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/django-selector.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/django-selector.qhc" latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ "run these through (pdf)latex." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." distro: html @echo @echo "Pushing documents to http://dev.jmoiron.net/python-bitbucket/" scp -r $(BUILDDIR)/html/* jmoiron@jmoiron.net:dev.jmoiron.net/python-bitbucket/ zip: html @echo @echo "Making zip file 'python-bitbucket.zip'" cd $(BUILDDIR)/html/; zip -r 'python-bitbucket.zip' * mv $(BUILDDIR)/html/'python-bitbucket.zip' . python-bitbucket-0.1/setup.py0000644000175000017500000000224611703371617015445 0ustar piotrpiotr#!/usr/bin/env python # -*- coding: utf-8 -*- """Setup script for python-bitbucket.""" from setuptools import setup, find_packages import sys, os version = '0.1' # some trove classifiers: # License :: OSI Approved :: MIT License # Intended Audience :: Developers # Operating System :: POSIX setup( name='python-bitbucket', version=version, description="python library for bitbucket API access", long_description=open('README.rst').read(), # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers classifiers=[ 'Development Status :: 1 - Planning', 'License :: OSI Approved :: MIT License', 'Intended Audience :: Developers', 'Operating System :: POSIX', ], keywords='bitbucket REST API', author='Jason Moiron', author_email='jmoiron@jmoiron.net', url='http://bitbucket.org/jmoiron/python-bitbucket', license='MIT', packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), include_package_data=True, zip_safe=False, test_suite="tests", install_requires=[ # -*- Extra requirements: -*- ], entry_points=""" # -*- Entry points: -*- """, ) python-bitbucket-0.1/LICENCE0000644000175000017500000000206111703371617014713 0ustar piotrpiotrCopyright (c) 2010 Jason Moiron and Contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. python-bitbucket-0.1/MANIFEST.in0000644000175000017500000000004311703371617015462 0ustar piotrpiotrinclude README.rst include LICENSE python-bitbucket-0.1/README.rst0000644000175000017500000000342111703371617015416 0ustar piotrpiotrpython-bitbucket ---------------- A simple python library to access the BitBucket API. API Coverage is not that high at the moment as the API has not been officially released and is still in a state of flux. Right now only read (GET) calls are supported. usage ===== API Usage all stems from the ``BitBucket`` object. You can instantiate one easily:: >>> import bitbucket >>> bb = bitbucket.BitBucket() >>> bb Certain areas of bitbucket's API require authentication or promise to provide more data if you are authenticated. Authentication lives on the ``BitBucket`` object, so if you want to authenticate pass the username and password:: >>> bb = bitbucket.BitBucket('jmoiron', 'mypassword') >>> bb If at any time you set both the ``username`` and ``password`` attributes on the bb object, authentication becomes active. BitBucket's auth is HTTP Basic over https. getting data ============ ``BitBucket`` provides an object-oriented wrapper around the API's REST structure. Top level API calls are available off the ``BitBucket`` object itself. To fetch a user, and poke around at his repositories:: >>> jmoiron = bb.user('jmoiron') >>> jmoiron >>> jmoiron.repositories() [{'description': 'simple python bitbucket API library', 'followers_count': 1, 'name': 'python-bitbucket', 'slug': 'python-bitbucket', 'website': 'http://bitbucket.org/jmoiron/python-bitbucket/'}, ... ] >>> pybb = jmoiron.repository('python-bitbucket') >>> pybb >>> pybb.tags() ... >>> pybb.branches() ... ``python-bitbucket`` does not attempt to format or abstract the return values of API calls in any way. python-bitbucket-0.1/__init__.py0000644000175000017500000000017511703371617016043 0ustar piotrpiotr# A file that gets executed when this project is imported as a library from .bitbucket import * # vim: set sts=4 sw=4 et :