mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Pass kwargs to retries
This commit is contained in:
@@ -15,7 +15,7 @@ from eve_api.utils import basic_xml_parse, basic_xml_parse_doc
|
|||||||
|
|
||||||
|
|
||||||
@task()
|
@task()
|
||||||
def import_eve_character(character_id, api_key=None, user_id=None, callback=None):
|
def import_eve_character(character_id, api_key=None, user_id=None, callback=None, **kwargs):
|
||||||
"""
|
"""
|
||||||
Imports a character from the API, providing a API key will populate
|
Imports a character from the API, providing a API key will populate
|
||||||
further details. Returns a single EVEPlayerCharacter object
|
further details. Returns a single EVEPlayerCharacter object
|
||||||
@@ -27,7 +27,7 @@ def import_eve_character(character_id, api_key=None, user_id=None, callback=None
|
|||||||
pchar = import_eve_character_func(character_id, api_key, user_id, log)
|
pchar = import_eve_character_func(character_id, api_key, user_id, log)
|
||||||
except APIAccessException, exc:
|
except APIAccessException, exc:
|
||||||
log.error('Error importing character - flagging for retry')
|
log.error('Error importing character - flagging for retry')
|
||||||
import_eve_character.retry(args=[char, api_key, user_id, callback], exc=exc)
|
import_eve_character.retry(args=[char, api_key, user_id, callback], exc=exc, kwargs=kwargs)
|
||||||
|
|
||||||
if callback:
|
if callback:
|
||||||
subtask(callback).delay(character=pchar.id)
|
subtask(callback).delay(character=pchar.id)
|
||||||
@@ -36,7 +36,7 @@ def import_eve_character(character_id, api_key=None, user_id=None, callback=None
|
|||||||
|
|
||||||
|
|
||||||
@task()
|
@task()
|
||||||
def import_eve_characters(character_list, api_key=None, user_id=None, callback=None):
|
def import_eve_characters(character_list, api_key=None, user_id=None, callback=None, **kwargs):
|
||||||
"""
|
"""
|
||||||
Imports characters from the API, providing a API key will populate
|
Imports characters from the API, providing a API key will populate
|
||||||
further details. Returns a list of EVEPlayerCharacter objects
|
further details. Returns a list of EVEPlayerCharacter objects
|
||||||
@@ -48,7 +48,7 @@ def import_eve_characters(character_list, api_key=None, user_id=None, callback=N
|
|||||||
results = [import_eve_character_func(char, api_key, user_id, log) for char in character_list]
|
results = [import_eve_character_func(char, api_key, user_id, log) for char in character_list]
|
||||||
except APIAccessException, exc:
|
except APIAccessException, exc:
|
||||||
log.error('Error importing characters - flagging for retry')
|
log.error('Error importing characters - flagging for retry')
|
||||||
import_eve_characters.retry(args=[char, api_key, user_id, callback], exc=exc)
|
import_eve_characters.retry(args=[char, api_key, user_id, callback], exc=exc, kwargs=kwargs)
|
||||||
if callback:
|
if callback:
|
||||||
subtask(callback).delay(characters=results)
|
subtask(callback).delay(characters=results)
|
||||||
else:
|
else:
|
||||||
@@ -60,7 +60,7 @@ def import_eve_character_func(character_id, api_key=None, user_id=None, logger=l
|
|||||||
try:
|
try:
|
||||||
char_doc = CachedDocument.objects.api_query('/eve/CharacterInfo.xml.aspx', params={'characterID': character_id}, no_cache=False)
|
char_doc = CachedDocument.objects.api_query('/eve/CharacterInfo.xml.aspx', params={'characterID': character_id}, no_cache=False)
|
||||||
except DocumentRetrievalError, exc:
|
except DocumentRetrievalError, exc:
|
||||||
logger.error('Error retrieving CharacterInfo.xml.aspx for Character ID %s - %s' % (user_id, character_id, exc))
|
logger.error('Error retrieving CharacterInfo.xml.aspx for Character ID %s - %s' % (character_id, exc))
|
||||||
raise APIAccessException
|
raise APIAccessException
|
||||||
|
|
||||||
d = basic_xml_parse_doc(char_doc)['eveapi']
|
d = basic_xml_parse_doc(char_doc)['eveapi']
|
||||||
|
|||||||
Reference in New Issue
Block a user