Skip to content

Commit

Permalink
switching to setup.cfg. reformatting using the black standard. adding…
Browse files Browse the repository at this point in the history
… requests to the reqs. updating readme a bit. adding get_recently_(modified, created) calls to the deals client
  • Loading branch information
jpetrucciani committed Jun 1, 2018
1 parent 7bc2b54 commit bea5b47
Show file tree
Hide file tree
Showing 33 changed files with 989 additions and 896 deletions.
4 changes: 0 additions & 4 deletions .flake8

This file was deleted.

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
.prospector
*.pyc
.coverage
.mypy_cache
.pytest_cache


# Created by https://www.gitignore.io/api/python

Expand Down
17 changes: 7 additions & 10 deletions .prospector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,22 @@ test-warnings: false

ignore-patterns:
- (^|/)\..+
- .*/env\.py
- .*\.html
- .*\.env\.py
- .*templates/

pylint:
disable:
- fixme
- bad-continuation
- too-many-arguments
- dangerous-default-value
- import-self
- broad-except
- no-self-use
- unused-argument
- import-error
- import-self
- logging-format-interpolation
- missing-docstring
- no-self-use
- unused-argument
- wrong-import-order

options:
max-arguments: 10
max-args: 10
max-locals: 100
max-returns: 6
max-branches: 50
Expand All @@ -44,6 +39,8 @@ mccabe:
pep8:
disable:
- N802
- N807
- W503
options:
max-line-length: 100
single-line-if-stmt: n
Expand Down
37 changes: 22 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
# hubspot3

[![PyPI version](https://badge.fury.io/py/hubspot3.svg)](https://badge.fury.io/py/hubspot3)
[![Code Health](https://landscape.io/github/jpetrucciani/hubspot3/master/landscape.svg?style=flat)](https://landscape.io/github/jpetrucciani/hubspot3/master)

[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)

A python wrapper around HubSpot\'s APIs, _for python 3_.

Built initially around hapipy, but heavily modified.

## Quick start

### Installation

```bash
# on ubuntu you may need this apt package:
sudo apt-get install libcurl4-openssl-dev

# install hubspot3
pip install hubspot3
```

### Basic Usage

```python
from hubspot3.companies import CompaniesClient
API_KEY = 'your-api-key'

API_KEY = "your-api-key"

client = CompaniesClient(api_key=API_KEY)

Expand All @@ -28,13 +38,13 @@ for company in client.get_all():
import json
from hubspot3.deals import DealsClient

deal_id = '12345'
API_KEY = 'your_api_key'
deal_id = "12345"
API_KEY = "your_api_key"

deals_client = DealsClient(api_key=API_KEY)

params = {
'includePropertyVersions': 'true'
"includePropertyVersions": "true"
} # Note values are camelCase as they appear in the Hubspot Documentation!

deal_data = deals_client.get(deal_id, params=params)
Expand All @@ -47,20 +57,20 @@ Be aware that this uses the HubSpot API directly, so you are subject to all of t
https://developers.hubspot.com/apps/api_guidelines

at the time of writing, HubSpot has the following limits in place for API requests:

- 10 requests per second
- 40,000 requests per day. This daily limit resets at midnight based on the time zone setting of the HubSpot account


## Extending the BaseClient - thanks [@Guysoft](https://github.com/guysoft)!

Some of the APIs are not yet complete! If you\'d like to use an API that isn\'t yet in this repo, you can extend the BaseClient class!
Some of the APIs are not yet complete! If you\'d like to use an API that isn\'t yet in this repo, you can extend the BaseClient class!

```python
import json
from hubspot3.base import BaseClient


PIPELINES_API_VERSION = '1'
PIPELINES_API_VERSION = "1"


class PipelineClient(BaseClient):
Expand All @@ -74,23 +84,20 @@ class PipelineClient(BaseClient):
def get_pipelines(self, **options):
params = {}

return self._call('pipelines', method='GET', params=params)
return self._call("pipelines", method="GET", params=params)

def _get_path(self, subpath):
return 'deals/v{}/{}'.format(
self.options.get('version') or PIPELINES_API_VERSION,
subpath
return "deals/v{}/{}".format(
self.options.get("version") or PIPELINES_API_VERSION, subpath
)


if __name__ == "__main__":
import json
API_KEY = "your_api_key"
a = PipelineClient(api_key=API_KEY)
print(json.dumps(a.get_pipelines()))
```


## List of available clients

```yaml
Expand Down
Loading

0 comments on commit bea5b47

Please sign in to comment.