# Example that uploads a file to the Portals File System using Portals API
# Access Level- Portals Domain Administrator
# Note: Uses Python 'Requests' module for calling API
# APIs:
# - http://docs.exosite.com/portals/#update-file-content


import requests
import getpass

directory = "images" #default directory name
domain = "" #example: example.exosite.com
user_email = "" #example: myname@example.com - assume administrator access to Portals Domain Solution
if domain == "":
	domain = raw_input('Enter Portals Domain (e.g. "example.exosite.com": ')
if user_email == "":
	user_email = raw_input('Enter Your Email Address: ')
user_password = getpass.getpass()  #ask for password each time at prompt


# Files to upload
files = {"MyLogo.png":open("./MyLogo.png", "rb"),
         "MyOtherLogo.jpg":open("./MyOtherLogo.jpg", "rb")
        }


url = "https://"+domain+"/api/portals/v1/fs/"+directory

print 'Uploading files to ' + domain

r = requests.post(url, files=files, auth=(user_email, user_password))

print("Status: ", r.status_code)

r = requests.get(url)

if r.status_code == 200:
        folder = r.json()
        for directory, filepath in folder.iteritems():
                for filename, filetype in filepath.iteritems():
                        print("/".join([url,directory,filename]))
@@ -232,18 +232,16 @@
 content%0A
-%0A%0A
 import r
@@ -294,16 +294,19 @@
 default 
+FS 
 director
@@ -319,24 +319,29 @@
 %0Adomain = %22%22
+     
  #example: e
@@ -374,16 +374,19 @@
 ail = %22%22
+   
  #exampl
@@ -704,17 +704,16 @@
 prompt%0A%0A
-%0A
 # Files 
@@ -842,17 +842,16 @@
      %7D%0A%0A
-%0A
 url = %22h

tidy up code