Skip to content

Commit

Permalink
Merge pull request #23 from predicthq/add_user_agent_header
Browse files Browse the repository at this point in the history
Add user-agent header
  • Loading branch information
vdmchernov committed Oct 1, 2018
2 parents 6560f0a + 1c76089 commit 47f6868
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -25,7 +25,7 @@ notifications:
secure: Mi4B2z6X0tE2vyfuF359/eXAxu8IgnOWT6REHBGYTGfB+baKtowBmQeMBTXe6aZFUuQ4vgnZAiq7KWgBwkpv4RuaP1BO9XkPwlnfXQOv6u4nIECGJcTiE4XTMl6zX1r4Km0X6kD9jP+Rvm6YCE6eiDf+xqLsMwECQstXYehwrT53fXnOYXhqP2girK+BFhJ5M2OYvz/K+kC+rMOGQjddic9SkNDYczTo22kVJ3OhIBkEC95UkfcFBEGE5/LP25zON9ptXv73aiuWjCNeaO/YBKog/hRJyYPdlwdaY7ENYiJHFCz/dRqDv32cNy28TTzdDOuE5Jic1OTMfvG2xnSjBZA/7R+msHqoVJ6Wn+IGlKvHCc4/etVoNpGyv7/tuXwAIY8s6ied4bLEvpSs/cEK0FMidZRcUoZ1+a2j28/rY7aqYef4sA0DwzplWMEoA680AAA4e0nGXIBbM6eb6aldd4oiIlW2F1PX0wGOXhdKYh7/rb2OxJ27rJTKsW8gbRN2OT3M9P5pdTAj5P7MmNIjKbJSxSemGhcfQIRl3FWn6oKIgQNbtWSkLEVh09JhjZJhnVlRtsPYr8rQQaMSc1EyQqDLicEB4lt0+Oe+Qq82HYWl6XfnzpTYc71mKrtjckdlDxBcAS9Rv1XNmBwQH9AbwcmifM0wOPJ5jiYXLmi4ucw=

before_deploy:
- echo $TRAVIS_TAG > VERSION
- echo "__version__ = '$TRAVIS_TAG'" > predicthq/version.py

deploy:
provider: pypi
Expand Down
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

2 changes: 1 addition & 1 deletion predicthq/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, print_function

from .client import Client
from .client import Client, __version__
assert Client
4 changes: 2 additions & 2 deletions predicthq/client.py
Expand Up @@ -10,7 +10,7 @@

from .config import config
from .exceptions import ClientError, ServerError

from .version import __version__

class Client(object):

Expand All @@ -35,7 +35,7 @@ def initialize_endpoints(self):
self.places = endpoints.PlacesEndpoint(proxy(self))

def get_headers(self, headers):
_headers = {"Accept": "application/json",}
_headers = {"Accept": "application/json", "x-user-agent": "PHQ-Python-SDK/{}".format(__version__)}
if self.access_token:
_headers.update({"Authorization": "Bearer {}".format(self.access_token),})
_headers.update(**headers)
Expand Down
1 change: 1 addition & 0 deletions predicthq/version.py
@@ -0,0 +1 @@
__version__ = '0.0.15'
10 changes: 8 additions & 2 deletions setup.py
Expand Up @@ -4,14 +4,20 @@
import codecs
from setuptools import setup, find_packages

here = os.path.abspath(os.path.dirname(__file__))


def read(*parts):
filename = os.path.join(os.path.dirname(__file__), *parts)
with codecs.open(filename, encoding="utf-8") as fp:
return fp.read()


VERSION = read("VERSION").strip()
about = {}

# Load version number dynamically
with open(os.path.join(here, 'predicthq', 'version.py'), 'r') as f:
exec(f.read(), about)

REPO_URL = "https://github.com/predicthq/sdk-py"

Expand All @@ -26,7 +32,7 @@ def read(*parts):

setup(
name="predicthq",
version=VERSION,
version=about['__version__'],
description="PredictHQ Event Intelligence",
long_description=LONG_DESCRIPTION,
license="MIT",
Expand Down

0 comments on commit 47f6868

Please sign in to comment.