Skip to content

Commit

Permalink
Merge pull request #3 from interakt/develop
Browse files Browse the repository at this point in the history
Resolved API Error bug
  • Loading branch information
amarjaiswal007 authored Nov 2, 2020
2 parents e0f5a30 + 8b04293 commit cf4473f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ The `identify` lets you tie a user to their actions and record traits about them
Example `identify` call:
```
track.identify(
user_id="<USER_ID>",
user_id="<user_id in your db>",
traits={
"name": "John Doe",
"email": "[email protected]",
Expand All @@ -76,19 +76,19 @@ The `identify` call has the following fields:




## Event
`event` track API lets you record the actions your users perform. Every action triggers what we call an “event”, which can also have associated properties.

Example `event` call:
```
track.event(
user_id="changu_mangu",
user_id="<user_id in your db>",
event="Product Added",
traits={"price": 200}
)
```
The `event` call has the following fields:

|Field|Data type|Description|
|--|--|--|
|user_id|str or int|The ID for the user in your database.|
Expand Down
2 changes: 1 addition & 1 deletion track/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def fatal_exception(exc):
# retry on server errors and client errors
# with 429 status code (rate limited),
# don't retry on other client errors
return (400 <= exc.status < 500) and exc.status != 429
return (400 <= exc.status_code < 500) and exc.status_code != 429
else:
# retry on all other errors (eg. network)
return False
Expand Down
6 changes: 3 additions & 3 deletions track/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ def post(write_key, host=None, path=None, body=None, timeout=10):

class APIError(Exception):

def __init__(self, status, code, message):
def __init__(self, status, status_code, message):
self.message = message
self.status = status
self.code = code
self.status_code = status_code

def __str__(self):
msg = "[interakt-track] StatusCode({0}): {1} (Success={2})"
return msg.format(self.code, self.message, self.status)
return msg.format(self.status_code, self.message, self.status)
2 changes: 1 addition & 1 deletion track/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '1.0.0'
VERSION = '1.0.1'

0 comments on commit cf4473f

Please sign in to comment.