Giter VIP home page Giter VIP logo

jpotts / alfresco-api-python-examples Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 1.0 136 KB

This project contains sample code that shows how to hit the public Alfresco API to do things like find the user's home network, find the sites the user can see, create folders and documents, and rate and comment on folders and documents. You must be a registered developer and have an Alfresco Cloud account.

Python 100.00%

alfresco-api-python-examples's Introduction

Alfresco API Python Examples

Installation

I strongly recommend you use virtualenv. Assuming you do that, the steps to install are:

  1. Create a directory somewhere, suppose it is alfresco-oauth.
  2. cd into alfresco-oauth and make a virtual environment by typing: virtualenv env
  3. Now activate your virtual environment by typing: source ./env/bin/activate
  4. This script requires oauth2client. The easiest way to install this is to type: easy_install oauth2client

Now you're ready to configure your application key and secret.

Configuration

You need to know your Alfresco Cloud API key and secret. Go snag those and come back.

  1. Edit client_secrets.json.sample.
  2. For client_id, specify your API key
  3. For client_secret, specify your secret
  4. Leave everything else alone and save as client_secrets.json

If you are going to run cmis_create_document.py, you must edit the script to set: NETWORK = 'alfresco.com' SITE = 'alfresco-api-demo' # A site that already exists FOLDER_NAME = 'test folder' # Name of a test folder to create FILE = '/Users/jpotts/Documents/sample/sample-a.pdf' # Name of a file to upload FILE_TYPE = 'application/pdf' # Mimetype of the file

Running

  1. Execute the script
  2. The script will invoke your default browser and ask you to grant access to the application.
  3. After you grant access, the script will continue to run. The script currently spits out your home network and a list of sites in your home network.
  4. The credential will be persisted to your keychain (untested on Windows!)

alfresco-api-python-examples's People

Contributors

jpotts avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

kikou2016

alfresco-api-python-examples's Issues

Unable to upload documents to Alfresco CMIS

Hi I am trying to load documents into Alfreso CMIS and I am getting this following error-

Python 3

from cmislib.model import CmisClient

FILE = '/home/monu/Fair-Work-Information-Statement.pdf'
file = open(FILE, 'rb')
fileName = file.name.split('/')[-1]
doc = None
FILE_TYPE = 'application/pdf'

try:
    doc = archive_folder_2.createDocument(str(fileName), contentFile=file, contentType=str(FILE_TYPE))
    print(f'Create Document { doc.id}')
except Exception as e:
    print(e)
    
file.close()

ERROR - 'bytes' object has no attribute 'encode'

Python 2.7

ERROR - Unable to parse non-GMT values at this stage

Not able to understand what is exactly wrong, as even .txt files are not getting uploaded. Can you help me to understand this error. Any hint would be highly appreciated. I am working on Mac OS.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.