Skip to content

Can't get the module to work #6

@rolanddaane

Description

@rolanddaane

Hi There,
Your module looks impressive!

However so I can't get it to work. Trying to connect 2 legged I get the below error.
I'm not sure what the callback url should be.....http://localhost:8080 ??
Here's what I'm trying:
from forge import ForgeApp # noqa:E402

2-legged context - Needed for methods that use the BIM 360 API

app = ForgeApp(
client_id="b.zzzzzzzzzzz",
client_secret="yyyyyyyyyyy",
hub_id="cf5307ae-78a7-435e-b77c-cef643b38e67",
)

app.get_users()
admin_user = app.find_user("admin_user@domain.com")
normal_user_1 = app.find_user("other_user_1@domain.com")
normal_user_2 = app.find_user("other_user_2@domain.com")

#############################################################################
C:\python>python get_project.py
Traceback (most recent call last):
File "C:\python\get_project.py", line 20, in
app.get_hubs()
^^^
NameError: name 'app' is not defined

C:\python>python get_project.py
2024-04-04 16:11:58 (UTC/GMT +0200) (forge.auth): INFO - Authorized Forge App
Traceback (most recent call last):
File "C:\python\get_project.py", line 27, in
app = ForgeApp(
^^^^^^^^^
File "C:\Users\rolan\AppData\Local\Programs\Python\Python312\Lib\site-packages\forge\forge.py", line 65, in init
self.hub_id = hub_id or os.environ.get("FORGE_HUB_ID")
^^^^^^^^^^^
File "C:\Users\rolan\AppData\Local\Programs\Python\Python312\Lib\site-packages\forge\forge.py", line 86, in hub_id
self._set_hub_id(val)
File "C:\Users\rolan\AppData\Local\Programs\Python\Python312\Lib\site-packages\forge\base.py", line 256, in _set_hub_id
raise ValueError("Invalid Hub ID")
ValueError: Invalid Hub ID

C:\python>python get_project.py
Traceback (most recent call last):
File "C:\Users\rolan\AppData\Local\Programs\Python\Python312\Lib\site-packages\forge\auth.py", line 214, in _set_auth_header
self.token_type, self.access_token
^^^^^^^^^^^^^^^
AttributeError: 'ForgeAuth' object has no attribute 'token_type'

During handling of the above exception, another exception occurred:
#############################################################################

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions