GithubHelp home page GithubHelp logo

forge-python-wrapper's Introduction

Forge Python Wrapper

Forge API Client Wrapper for Python

Installing

WIP

Documentation

WIP

Usage Examples

"""
If the following Environment Variables are defined there is no need to explicitly provide them when constructing the ForgeApp:
    For 2-legged context:
        FORGE_HUB_ID
        FORGE_CLIENT_ID
        FORGE_CLIENT_SECRET
    Extras for 3-legged context:
        FORGE_REDIRECT_URI
        FORGE_USERNAME
        FORGE_PASSWORD
"""

# 3-legged context - Needed to work with BIM 360 Team Hubs
app = ForgeApp(
    client_id="<your_app_client_id>",
    client_secret="<your_app_client_secret>",
    three_legged=True,
    redirect_uri="<your_app_redirect_uri>",
    username="<your_autodesk_username>",
    password="<your_autodesk_password>",
)

app.get_hubs()
app.hub_id = app.hubs[0]["id"]

app.get_projects(source="docs")
project = app.find_project("<Project Name>", key="name")
project = app.find_project("<Project Id>", key="id")

project.get_top_folders()
top_folders = project.top_folders

project.project_files.get_contents()
contents = project.project_files.contents

parent_folder_id = pj.project_files.id
project.add_folder(pj.project_files.id, "New Folder Name")


# 2-legged context - Needed for methods that use the BIM 360 API
app = ForgeApp(
    client_id="<your_app_client_id>",
    client_secret="<your_app_client_secret>",
    hub_id="<your_hub_id>",
)

app.get_companies()
company = app.find_company("Company Name")

app.get_users()
admin_user = app.find_user("[email protected]")
normal_user_1 = app.find_user("[email protected]")
normal_user_2 = app.find_user("[email protected]")

app.get_projects(source="all")

new_project = app.add_project("New Project Name")

new_project.update(name="Updated Project Name", status="active")

new_project.get_roles()
roles = new_project.roles
role_id = roles[0]["id"]

new_project.x_user_id = admin_user["uid"]
new_project.add_users([admin_user], access_level="admin")
new_project.add_users([normal_user_1, normal_user_2], access_level="user", role_id=role_id)

new_role_id = roles[1]["id"]
new_project.update_user(normal_user_1, company_id=company["id"], role_id=new_role_id)

License

MIT

forge-python-wrapper's People

Contributors

lfparis avatar

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.