Ingestion Service Data Endpoint using Attachments

I am looking to use the Ingestion Service data endpoint (not the files endpoint) with the Python requests.post().

Is there example code in Python using the api/training/data endpoint?

How would one modify the following to use attachments[]?

res = requests.post(url='https://ingestion.edgeimpulse.com/api/training/data',
                        data='mark.jpg',
                        headers={
								'x-api-key':   'ei_...',                            
								'x-file-name': 'mark.jpg',
								'x-label':     'mark', })

An alternate solution might be if someone could help convert the cURL syntax:

-F attachments[]="@metadata.json;type=application/json" \
-F attachments[]="@mark.jpg;type=image/jpeg"

into an argument compatible with the Python requests.post()?

Do not use the data endpoint since it is obsolete. Use the files endpoint instead. See this for example code of how to use the files endpoint and recursively upload files going thru sub-folders. The sub-folders are the class names so we can automagically label each file.