Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cid is optional if uid is used. #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ Available methods
Available parameters
--------------------

All methods require cid (Client ID). The value of this field
All methods accept cid (Client ID). This field is mandatory,
unless uid (User ID) is provided. The value of the cid field
should be a random UUID (version 4) as described in
`<http://www.ietf.org/rfc/rfc4122.txt>`_

Expand Down
21 changes: 11 additions & 10 deletions aioga/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ def __init__(

self.futs = set()

def _prepare_params(self, request_type, cid, **kwargs):
def _prepare_params(self, request_type, cid=None, **kwargs):
params = {
'v': self.version,
'tid': self.tracking_id,
'cid': cid,
't': request_type,
}
if cid is not None:
params['cid'] = cid

params.update(**kwargs)

Expand Down Expand Up @@ -79,28 +80,28 @@ def _request(self, *args, **kwargs):

return fut

def pageview(self, cid, **kwargs):
def pageview(self, cid=None, **kwargs):
return self._request('pageview', cid, **kwargs)

def screenview(self, cid, **kwargs):
def screenview(self, cid=None, **kwargs):
return self._request('screenview', cid, **kwargs)

def event(self, cid, **kwargs):
def event(self, cid=None, **kwargs):
return self._request('event', cid, **kwargs)

def transaction(self, cid, **kwargs):
def transaction(self, cid=None, **kwargs):
return self._request('transaction', cid, **kwargs)

def item(self, cid, **kwargs):
def item(self, cid=None, **kwargs):
return self._request('item', cid, **kwargs)

def social(self, cid, **kwargs):
def social(self, cid=None, **kwargs):
return self._request('social', cid, **kwargs)

def exception(self, cid, **kwargs):
def exception(self, cid=None, **kwargs):
return self._request('exception', cid, **kwargs)

def timing(self, cid, **kwargs):
def timing(self, cid=None, **kwargs):
return self._request('timing', cid, **kwargs)

async def close(self):
Expand Down