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: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ python:

install:
- pip install -U pip
- pip install pypandoc
- pip install .[test]
- if [[ $TRAVIS_PYTHON_VERSION != 2.7 ]]; then pip install .[async]; fi

Expand Down
110 changes: 110 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
## History

### 0.1.0 (2016-11-09)

- First release on gemfury

### 0.1.1 (2016-11-09)

- change names

### 0.1.2 (2016-11-09)

- fix issue with 401-retry

### 0.1.3 (2016-11-10)

- add dependencies to setup.py

### 0.1.4 (2016-11-11)

- cli tool

### 0.1.5 (2016-11-11)

- fix apikey url query param error

### 0.1.6 (2016-11-11)

- introduce different token\_issuer\_host thatn api\_host

### 0.1.7 (2016-12-06)

- Introduce context\_getter on session object, defaulted to holding
CorrelationId=random\_uuid

### 1.0.0 (2017-02-01)

- first release as oss, major refactoring of inner machinery (session
objects, retry policies, cli, tests etc)

### 1.1.0 (2017-06-12)

- fixed logging so it does not use root logger. according to best
practices mentioned in
<http://pythonsweetness.tumblr.com/post/67394619015/use-of-logging-package-from-within-a-library>
- removed dependency on httpretty since it is not supporting py3

### 2.0.0 (2017-09-29)

- DEPRECATED: create\_session is getting deprecated, use
trustpilot.client.default\_session.setup instead
- now able to query public endpoints without being authenticated

### 2.1.0 (2017-10-05)

- fixed issue in cli.post & cli.put where 'content\_type' should be
'content-type'

### 3.0.0 (2018-01-18)

DELETED DO NOT USE\!\!

- add async-client

### 3.0.1 (2018-01-18)

- removed prints
- made async\_client retry on unauthorized

### 4.0.0 (2018-06-06)

- drop support for Python 3.3

### 4.0.1 (2018-06-06)

- Switch to non-deprecated session object for utility method calls

### 4.0.2 (2018-10-30)

- Upgrade requests to 2.20.0

### 5.0.0 (2019-01-04)

- Update to authentication methods

### 5.0.1 (2019-02-04)

- Fix documentation formatting

### 6.0.0 (2019-02-06)

- reorganize code
- add user-agent header
- get access\_token with async call in async\_client

### 6.0.3 (2019-08-15)

- Added support for 'API Version' parameter for Client initialisation.

### 6.0.4 (2019-08-15)

- Remove auto-deploy to travis

### 6.0.5 (2019-08-15)

- allow newer version of requests dependency

### 6.0.6 (2019-09-18)

- specify user agent through env-var or kwarg
127 changes: 0 additions & 127 deletions HISTORY.rst

This file was deleted.

3 changes: 1 addition & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

include CONTRIBUTING.rst
include HISTORY.rst
include HISTORY.md
include README.md

recursive-include tests *
Expand Down
85 changes: 4 additions & 81 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,81 +1,4 @@
.PHONY: clean clean-test clean-pyc clean-build docs help
.DEFAULT_GOAL := help
define BROWSER_PYSCRIPT
import os, webbrowser, sys
try:
from urllib import pathname2url
except:
from urllib.request import pathname2url

webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
endef
export BROWSER_PYSCRIPT

define PRINT_HELP_PYSCRIPT
import re, sys

for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
BROWSER := python -c "$$BROWSER_PYSCRIPT"

help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts


clean-build: ## remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +

clean-pyc: ## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +

clean-test: ## remove test and coverage artifacts
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/
rm -f test_readme.py


lint: ## check style with flake8
flake8 python_simple_trustpilo_api_client tests

test: ## run tests quickly with the default Python
py.test

tox: ## run tests quickly with the default Python
rm -rf .tox
detox

test-all: clean ## run all versions/tests with dtox (dockerized)
@echo "Running all tests in Docker using dtox"
rm -rf .tox
docker run --rm -it -v "$$PWD":/src:ro realcundo/dtox "$$PWD"

coverage: ## check code coverage quickly with the default Python
coverage run --source python_simple_trustpilo_api_client -m pytest

coverage report -m
coverage html
$(BROWSER) htmlcov/index.html

release: clean ## package and upload a release
python setup.py sdist upload
python setup.py bdist_wheel upload

dist: clean ## builds source and wheel package
python setup.py sdist
python setup.py bdist_wheel
ls -l dist
release:
rm dist/*
python setup.py sdist build
python -m twine upload dist/*
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ async def get_response():
loop.run_until_complete(get_response())
```

## Setup User Agent

A UserAgent header can be specified in two ways:

1. By populating the `TRUSTPILOT_USER_AGENT` environment var
2. By creating your own (async/sync)-client instance, or calling `setup` on the `default_session`, and supplying the kwargs `user_agent=foobar`

If no user-agent is given it will autopopulate using the function in `get_user_agent` function in [auth.py](./trustpilot/auth.py)

## CLI

Expand Down
1 change: 1 addition & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
collect_ignore.append("trustpilot/async_client.py")

from pytest_readme import setup

setup()
Loading