8000 Update quote linting by griffinmyers · Pull Request #37 · button/button-client-python · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Current Version
- Update flake8 quote linting
- Add official support for Python 3.7
- Drop official support for Python 2.6, 3.2, 3.3

Expand Down
4 changes: 2 additions & 2 deletions pybutton/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


class Client(object):
'''Top-level interface for making requests to the Button API.
"""Top-level interface for making requests to the Button API.

All resources implemented in this client will be exposed as attributes of a
pybutton.Client instance.
Expand All @@ -37,7 +37,7 @@ class Client(object):
Raises:
pybutton.ButtonClientError

'''
"""

def __init__(self, api_key, config=None):

Expand Down
8 changes: 4 additions & 4 deletions pybutton/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@


class ButtonClientError(Exception):
'''An Exception class for all pybutton understood errors.
'''
"""An Exception class for all pybutton understood errors.
"""


class HTTPResponseError(ButtonClientError):
'''A non-success HTTP response was returned from the remote API.
"""A non-success HTTP response was returned from the remote API.

The HTTP response status code can be retrieved from the
`.status_code` property.

The original error object can be retrieved from the
`.cause` property.
'''
"""
def __init__(self, message, status_code, cause):
super(HTTPResponseError, self).__init__(message)
self.status_code = status_code
Expand Down
16 changes: 8 additions & 8 deletions pybutton/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from urllib.parse import parse_qs

def request(url, method, headers, data=None, timeout=None):
''' Make an HTTP request in Python 3.x
""" Make an HTTP request in Python 3.x

This method will abstract the underlying organization and invocation of
the Python 3 HTTP standard lib implementation.
Expand All @@ -45,7 +45,7 @@ def request(url, method, headers, data=None, timeout=None):
Returns:
(dict): The response from the server interpreted as JSON.

'''
"""

encoded_data = json.dumps(data).encode('utf8') if data else None
request = Request(url, data=encoded_data, headers=headers)
Expand All @@ -71,7 +71,7 @@ def request(url, method, headers, data=None, timeout=None):
from urlparse import parse_qs

def request(url, method, headers, data=None, timeout=None):
''' Make an HTTP request in Python 2.x
""" Make an HTTP request in Python 2.x

This method will abstract the underlying organization and invocation of
the Python 2 HTTP standard lib implementation.
Expand All @@ -90,7 +90,7 @@ def request(url, method, headers, data=None, timeout=None):
Returns:
(dict): The response from the server interpreted as JSON.

'''
"""

request = Request(url)
request.get_method = lambda: method
Expand All @@ -111,7 +111,7 @@ def request(url, method, headers, data=None, timeout=None):


def request_url(secure, hostname, port, path, query=None):
'''
"""
Combines url components into a url passable into the request function.

Args:
Expand All @@ -123,7 +123,7 @@ def request_url(secure, hostname, port, path, query=None):

Returns:
(str) A complete url made up of the arguments.
'''
"""
encoded_query = urlencode(query) if query else ''
scheme = 'https' if secure else 'http'
netloc = '{0}:{1}'.format(hostname, port)
Expand All @@ -132,7 +132,7 @@ def request_url(secure, hostname, port, path, query=None):


def query_dict(url):
'''
"""
Given a url, returns a dictionary of its query parameters.

Args:
Expand All @@ -145,7 +145,7 @@ def query_dict(url):
...
}

'''
"""
url_components = urlparse(url)

if (url_components):
Expand Down
12 changes: 6 additions & 6 deletions pybutton/resources/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@


class Accounts(Resource):
'''Manages interacting with Button Accounts via the Button API
"""Manages interacting with Button Accounts via the Button API

See Resource for class docstring.

'''
"""

def all(self):
'''Get a list of available accounts
"""Get a list of available accounts

Raises:
pybutton.ButtonClientError

Returns:
(pybutton.Response) The API response

'''
"""

return self.api_get('/v1/affiliation/accounts')

def transactions(self, account_id, cursor=None, start=None, end=None,
time_field=None):
'''Get a list of transactions.
"""Get a list of transactions.
To paginate transactions, pass the result of response.next_cursor() as
the cursor argument.

Expand All @@ -50,7 +50,7 @@ def transactions(self, account_id, cursor=None, start=None, end=None,
Returns:
(pybutton.Response) The API response

'''
"""

query = {}

Expand Down
16 changes: 8 additions & 8 deletions pybutton/resources/customers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,30 @@


class Customers(Resource):
'''Manages interacting with Button Customers via the Button API
"""Manages interacting with Button Customers via the Button API

See Resource for class docstring.

'''
"""

def _path(self, customer_id=None):
'''Format a url path
"""Format a url path

Args:
customer_id (str) optional: A Button customer id ('customer-XXX')

Returns:
(str): The formatted path

'''
"""

if customer_id:
return '/v1/customers/{0}'.format(customer_id)
else:
return '/v1/customers'

def get(self, customer_id):
'''Get a customer
"""Get a customer

Args:
customer_id (str) : A Button customer id ('customer-XXX')
Expand All @@ -41,12 +41,12 @@ def get(self, customer_id):
Returns:
(pybutton.Response) The API response

'''
"""

return self.api_get(self._path(customer_id))

def create(self, customer):
'''Create an customer
"""Create an customer

Args:
customer (dict): A dict representing the attributes of an customer
Expand All @@ -57,6 +57,6 @@ def create(self, customer):
Returns:
(pybutton.Response) The API response

'''
"""

return self.api_post(self._path(), customer)
16 changes: 8 additions & 8 deletions pybutton/resources/links.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@


class Links(Resource):
'''Manages interacting with Button Links via the Button API
"""Manages interacting with Button Links via the Button API

See Resource for class docstring.

'''
"""

def _path(self):
'''Format a url path
"""Format a url path

Args:
link (dict): A dict representing the attributes of a link

Returns:
(str): The formatted path

'''
"""

return '/v1/links'

def create(self, link):
'''Create a link
"""Create a link

Args:
link (dict): A dict representing the attributes of a link
Expand All @@ -38,12 +38,12 @@ def create(self, link):
Returns:
(pybutton.Response) The API response

'''
"""

return self.api_post(self._path(), link)

def get_info(self, link):
'''Get info on a link
"""Get info on a link

Args:
link (dict): A dict representing the attributes of a link for info
Expand All @@ -54,6 +54,6 @@ def get_info(self, link):
Returns:
(pybutton.Response) The API response

'''
"""

return self.api_post(self._path() + '/info', link)
8 changes: 4 additions & 4 deletions pybutton/resources/merchants.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@


class Merchants(Resource):
'''Manages interacting with Button Merchants via the Button API
"""Manages interacting with Button Merchants via the Button API

See Resource for class docstring.

'''
"""

def all(self, status=None, currency=None):
'''Get a list of merchants and their configured rates
"""Get a list of merchants and their configured rates

Args:
status (str) optional: A status to filter by. One of ('approved',
Expand All @@ -28,7 +28,7 @@ def all(self, status=None, currency=None):
Returns:
(pybutton.Response) The API response

'''
"""

query = {}

Expand Down
24 changes: 12 additions & 12 deletions pybutton/resources/orders.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,30 @@


class Orders(Resource):
'''Manages interacting with Button Orders via the Button API
"""Manages interacting with Button Orders via the Button API

See Resource for class docstring.

'''
"""

def _path(self, order_id=None):
'''Format a url path
"""Format a url path

Args:
order_id (str) optional: A Button order id ('btnorder-XXX')

Returns:
(str): The formatted path

'''
"""

if order_id:
return '/v1/order/{0}'.format(order_id)
else:
return '/v1/order'

def get(self, order_id):
'''Get an order
"""Get an order

Args:
order_id (str) : A Button order id ('btnorder-XXX')
Expand All @@ -41,12 +41,12 @@ def get(self, order_id):
Returns:
(pybutton.Response) The API response

'''
"""

return self.api_get(self._path(order_id))

def create(self, order):
'''Create an order
"""Create an order

Args:
order (dict): A dict representing the attributes of an order
Expand All @@ -57,12 +57,12 @@ def create(self, order):
Returns:
(pybutton.Response) The API response

'''
"""

return self.api_post(self._path(), order)

def update(self, order_id, order):
'''Update an order
"""Update an order

Args:
order_id (str) : A Button order id ('btnorder-XXX')
Expand All @@ -74,12 +74,12 @@ def update(self, order_id, order):
Returns:
(pybutton.Response) The API response

'''
"""

return self.api_post(self._path(order_id), order)

def delete(self, order_id):
'''Delete an order
"""Delete an order

Args:
order_id (str) : A Button order id ('btnorder-XXX')
Expand All @@ -90,6 +90,6 @@ def delete(self, order_id):
Returns:
(pybutton.Response) The API response

'''
"""

return self.api_delete(self._path(order_id))
Loading
0