Destiny2 API - TransferItem Error. Need some help

Started by
1 comment, last by hplus0603 3 years ago

first, sorry for bad english

I'm making small version of Inventory Manager of Destiny2 by Python and Bungie.net API, but every request I do always give me error : DestinyItemNotFound

I got ItemHash and ItemInstanceID from character inventory (included in response of getCharacter)

I always check parameter before request Transfer, but what i got is always just error message from bungie net

here's my code, please help

def post_transfer_item(itemHash, Instance_id, transfer_to_vault, character_id, membership_type):
global headers
url = f'{API_ROOT_PATH}/Destiny2/Actions/Items/TransferItem/'

data = {
'itemReferenceHash': int(itemHash),
'stackSize': 1,
'transferToVault': transfer_to_vault,
'itemId': int(Instance_id),
'characterId': int(character_id),
'membershipType': int(membership_type.value)
}

api_call = requests.post(url, json=json.dumps(data), headers=headers)
return json.loads(api_call.text)

for item in user.character_inventory[user.character_ids[0]]['items']:
tmp = get_hash_definition(Definitions.ITEM, item['itemHash'])

if tmp['itemTypeDisplayName'] in item_type:
inv.append({'name': tmp['displayProperties']['name'], 'icon': tmp['displayProperties']['icon'], 'type': tmp['itemTypeAndTierDisplayName'], 'flavorText': tmp['flavorText'], 'itemHash': item['itemHash'], 'InstanceID': item['itemInstanceId']})

resp = [post_transfer_item(inv[0]['itemHash'], inv[0]['InstanceID'], True, user.character_ids[0], user.membership_type)]

Advertisement

When I have these kinds of problems, I find that it's often helpful to try to craft the right HTTP request using a tool like curl so that I know I'm getting the headers and payload right.

Once I can get it working in curl I can then translate it to whatever language I'm using (such as Python) and hopefully it will work the same. If it doesn't, I then need to break out tools like Wireshark or debug-dumping functions inside the script, or point the script at a sample server that I run that will dump incoming requests for diagnosis.

enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement