@@ -343,7 +343,7 @@ def get_access_url(self):
343343 """
344344 return self ._access_url
345345
346- def get_access_params (self , article_ids , lptoken = None ):
346+ def get_access_params (self , article_ids , lptoken = None , muid = None ):
347347 """
348348 Return a params ``dict`` for /access call.
349349
@@ -352,6 +352,7 @@ def get_access_params(self, article_ids, lptoken=None):
352352 :param article_ids: list of article ids or a single article id as a
353353 string
354354 :param lptoken: optional lptoken as `str`
355+ :param str muid: merchant defined user ID. Optional.
355356 """
356357 if not isinstance (article_ids , (list , tuple )):
357358 article_ids = [article_ids ]
@@ -363,6 +364,13 @@ def get_access_params(self, article_ids, lptoken=None):
363364 'article_id' : article_ids ,
364365 }
365366
367+ if muid :
368+ # TODO: The behavior when lptoken and muid are given is not yet
369+ # defined. Thus we'll allow both at the same time for now. It might
370+ # be that in the end only one is allowed or one is prefered over
371+ # the other.
372+ params ['muid' ] = muid
373+
366374 params ['hmac' ] = signing .sign (
367375 secret = self .shared_secret ,
368376 params = params .copy (),
@@ -372,7 +380,7 @@ def get_access_params(self, article_ids, lptoken=None):
372380
373381 return params
374382
375- def get_access_data (self , article_ids , lptoken = None ):
383+ def get_access_data (self , article_ids , lptoken = None , muid = None ):
376384 """
377385 Perform a request to /access API and return obtained data.
378386
@@ -383,8 +391,9 @@ def get_access_data(self, article_ids, lptoken=None):
383391 :param article_ids: list of article ids or a single article id as a
384392 string
385393 :param lptoken: optional lptoken as `str`
394+ :param str muid: merchant defined user ID. Optional.
386395 """
387- params = self .get_access_params (article_ids = article_ids , lptoken = lptoken )
396+ params = self .get_access_params (article_ids = article_ids , lptoken = lptoken , muid = muid )
388397 url = self .get_access_url ()
389398 headers = self .get_request_headers ()
390399
0 commit comments