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
7 changes: 3 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ Configure your client
.. code:: python

from intercom.client import Client
intercom = Client(app_id='my_app_id', api_key='my_api_key')

You can get your app_id from the URL when you're logged into Intercom (it's the alphanumeric just after /apps/) and your API key from the API keys integration settings page (under your app settings - integrations in Intercom).
intercom = Client(personal_access_token='my_personal_access_token')

Note that certain resources will require an extended scope access token : `Setting up Personal Access Tokens <https://developers.intercom.com/docs/personal-access-tokens>`_

Resources
~~~~~~~~~
Expand Down Expand Up @@ -552,7 +551,7 @@ Integration tests:

.. code:: bash

INTERCOM_APP_ID=xxx INTERCOM_APP_API_KEY=xxx nosetests tests/integration
INTERCOM_PERSONAL_ACCESS_TOKEN=xxx nosetests tests/integration

.. |PyPI Version| image:: https://img.shields.io/pypi/v/python-intercom.svg
:target: https://pypi.python.org/pypi/python-intercom
Expand Down
2 changes: 1 addition & 1 deletion docs/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Run the integration tests:
::

# THESE SHOULD ONLY BE RUN ON A TEST APP!
INTERCOM_APP_ID=xxx INTERCOM_APP_API_KEY=xxx nosetests tests/integration
INTERCOM_PERSONAL_ACCESS_TOKEN=xxx nosetests tests/integration

Generate the Documentation
--------------------------
Expand Down
7 changes: 3 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@ Usage
Authentication
---------------

Intercom documentation: `Authentication <http://api.intercom.io/docs#authentication>`_.
Intercom documentation: `Authentication <https://developers.intercom.com/docs#authentication>`_.

::

from intercom import Intercom
Intercom.app_id = 'dummy-app-id'
Intercom.app_api_key = 'dummy-api-key'
from intercom.client import Client
intercom = Client(personal_access_token='my_personal_access_token')

Users
-----
Expand Down
7 changes: 3 additions & 4 deletions intercom/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@

class Client(object):

def __init__(self, app_id='my_app_id', api_key='my_api_key'):
self.app_id = app_id
self.api_key = api_key
def __init__(self, personal_access_token='my_personal_access_token'):
self.personal_access_token = personal_access_token
self.base_url = 'https://api.intercom.io'
self.rate_limit_details = {}

@property
def _auth(self):
return (self.app_id, self.api_key)
return (self.personal_access_token, '')

@property
def admins(self):
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/issues/test_72.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
from intercom.client import Client

intercom = Client(
os.environ.get('INTERCOM_APP_ID'),
os.environ.get('INTERCOM_API_KEY'))
os.environ.get('INTERCOM_PERSONAL_ACCESS_TOKEN'))


class Issue72Test(unittest.TestCase):
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/issues/test_73.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
from intercom.client import Client

intercom = Client(
os.environ.get('INTERCOM_APP_ID'),
os.environ.get('INTERCOM_API_KEY'))
os.environ.get('INTERCOM_PERSONAL_ACCESS_TOKEN'))


class Issue73Test(unittest.TestCase):
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from intercom.client import Client

intercom = Client(
os.environ.get('INTERCOM_APP_ID'),
os.environ.get('INTERCOM_API_KEY'))
os.environ.get('INTERCOM_PERSONAL_ACCESS_TOKEN'))


class AdminTest(unittest.TestCase):
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/test_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
from . import get_timestamp

intercom = Client(
os.environ.get('INTERCOM_APP_ID'),
os.environ.get('INTERCOM_API_KEY'))
os.environ.get('INTERCOM_PERSONAL_ACCESS_TOKEN'))


class CompanyTest(unittest.TestCase):
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/test_conversations.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
from . import get_timestamp

intercom = Client(
os.environ.get('INTERCOM_APP_ID'),
os.environ.get('INTERCOM_API_KEY'))
os.environ.get('INTERCOM_PERSONAL_ACCESS_TOKEN'))


class ConversationTest(unittest.TestCase):
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/test_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
from . import get_timestamp

intercom = Client(
os.environ.get('INTERCOM_APP_ID'),
os.environ.get('INTERCOM_API_KEY'))
os.environ.get('INTERCOM_PERSONAL_ACCESS_TOKEN'))


class NoteTest(unittest.TestCase):
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/test_segments.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from intercom.client import Client

intercom = Client(
os.environ.get('INTERCOM_APP_ID'),
os.environ.get('INTERCOM_API_KEY'))
os.environ.get('INTERCOM_PERSONAL_ACCESS_TOKEN'))


class SegmentTest(unittest.TestCase):
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/test_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
from . import get_timestamp

intercom = Client(
os.environ.get('INTERCOM_APP_ID'),
os.environ.get('INTERCOM_API_KEY'))
os.environ.get('INTERCOM_PERSONAL_ACCESS_TOKEN'))


class TagTest(unittest.TestCase):
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
from . import delete_user

intercom = Client(
os.environ.get('INTERCOM_APP_ID'),
os.environ.get('INTERCOM_API_KEY'))
os.environ.get('INTERCOM_PERSONAL_ACCESS_TOKEN'))


class UserTest(unittest.TestCase):
Expand Down