Пример #1
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from SugarCRMAPI import SugarCRMAPI
import os
from os.path import basename
import csv

host = ""
user_name = ""
password = ""
clientId = ""
clientSecret = ""
directory = ""
api = SugarCRMAPI(host, clientId, clientSecret)
result = api.oauth2_token(user_name, password)
# Validar access_token
uploaded = False
with open('result.csv', 'wb') as csvfile:
    spamwriter = csv.writer(csvfile,
                            delimiter=',',
                            quotechar='"',
                            quoting=csv.QUOTE_ALL,
                            skipinitialspace=True)
    for dirname, dirnames, filenames in os.walk(directory):
        if uploaded:
            break
        for filename in filenames:
            if uploaded:
                break
            path = os.path.join(dirname, filename)
            filename, file_extension = os.path.splitext(path)