'POST xml from local directory using Python

I want to make a Python script to automate a submission to Facebook commerce manager catalog and I have no issue so far with setting things up until the last part where I need to upload my xml file. I have no website to host my xml file as url thus I need to upload it from my local directory however it seems to unable to find a proper path to upload the file.


def uploadProductFeed(params,feed_id):

    url = params['endpoint_base'] + feed_id + "/uploads"
    endpointParams = dict()
    endpointParams['file'] = '@CatalogFeed.xml;type=text/xml'
    endpointParams['access_token'] = params['access_token']

    return makeApiCall(url,endpointParams,'POST')

For more information my script is stored in the same directory as the xml which is C://.../Scripts. When I run the code, it gave no error, however in the same time it does not upload the xml file to the catalog. I have tried using a url method which work but failed due to i have no proper web setup so in a way I know the code should've worked. Thanks in advance!!!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source