Through the shopify team, my problem has been solved. In addition to the permission of write_merchant_managed_fulfillment_orders, the permission of write_third_party_fulfillment_orders needs to be added.
grab some orders with “test” tag, json.loads str->dict
result = json.loads(shopify.GraphQL().execute(‘{orders(first:10, query:“tag:test”){edges{node{id tags}}}}’))
data = [d.get(‘node’) for d in result.get(“data”).get(‘orders’).get(‘edges’)]
order_ids = [item.get(‘id’).split(‘/’)[-1] for item in data]
for id in order_ids:
order = shopify.Order.find(id)
print(“order”, order.id)
for f in order.fulfillments:
print(“fulfillement id”, f.id)
f.update_tracking(tracking_info={‘number’:‘YOANNTEST02’,“company”:“la poste”,“url”:None},notify_customer=False)
print(“modify tracking number”)