http://img.shields.io/travis/retr0h/git-url-parse.svg?style=popout-square&logo=travis https://img.shields.io/codecov/c/github/retr0h/git-url-parse.svg?style=popout-square&logo=codecov https://img.shields.io/pypi/v/git-url-parse.svg?style=popout-square&logo=python https://img.shields.io/readthedocs/git-url-parse.svg?style=popout-square&logo=Read%20the%20Docs

giturlparse

A simple GIT URL parser similar to giturlparse.py.

License

MIT

Contents:

Usage

This tool will parse a GIT URL and return a Parsed object.

import giturlparse

p = giturlparse.parse('git@github.com:retr0h/ansible-etcd.git')
p.pathname
p.protocols
p.protocol
p.href
p.resource
p.user
p.port
p.name
p.owner

Testing

$ pip install tox
$ tox

History

1.2.2

  • Corrected processing of name with a dot.

1.2.1

  • Corrected processing of URLs with a hyphen.

1.2

  • Improved parsing speed by compiling regex on global context and reusing named collection.

1.1

  • Cleaned up unused packages from requirements.
  • Added python 3.4 and 3.5 support.
  • Further parsing of valid git URLs.
  • Pass pep8 and yapf.
  • Added to travis ci.
  • Execute one regex at a time.

1.0.2

  • Corrected pbr version info package name.

1.0.1

  • Support parsing domains which contain a hyphen.

1.0

  • Initial release.

Credits

Development Leads

Core Committers

Contributors

Autodoc

Parser

class giturlparse.parser.Parser(url)

A class responsible for parsing a GIT URL and return a Parsed object.

parse()

Parses a GIT URL and returns an object. Raises an exception on invalid URL.

Returns:Parsed object
Raise:ParserError
class giturlparse.parser.ParserError

Error raised when a URL can’t be parsed.

Indices and tables