Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,5 @@ replay_pid*
# snippet testing files
*snippets_*
specs/
sample_responses/
sample_responses/
.DS_Store
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [0.7.1] - 2025-06-19

### Added
* `submittals`: add `get_types()` method with snippets in `submittals.ipynb`

### Changed
* `submittals`: add `types` parameter to `get()` method

## [0.7.0] - 2025-06-18

### Added
Expand Down
2 changes: 1 addition & 1 deletion ProPyCore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
from .exceptions import *
from .procore import Procore

__version__ = "0.7.0"
__version__ = "0.8.0"
12 changes: 12 additions & 0 deletions ProPyCore/access/drawings/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from .sets import Sets
from .revisions import Revisions
from .uploads import Uploads
from .tiles import Tiles


class Drawings:
def __init__(self, access_token, server_url):
self.sets = Sets(access_token, server_url)
self.revisions = Revisions(access_token, server_url)
self.uploads = Uploads(access_token, server_url)
self.tiles = Tiles(access_token, server_url)
81 changes: 81 additions & 0 deletions ProPyCore/access/drawings/revisions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
from ..base import Base
from ...exceptions import NotFoundItemError

class Revisions(Base):
def __init__(self, access_token, server_url) -> None:
super().__init__(access_token, server_url)

self.endpoint = "/rest/v1.0"

def get(self, company_id, project_id, per_page=100):
"""
Gets all the available drawing revisions

Parameters
----------
company_id : int
unique identifier for the company
project_id : int
unique identifier for the project
per_page : int, default 100
number of drawing revisions to include per page

Returns
-------
drawing_revisions : list
available drawing revisions data
"""
headers = {
"Procore-Company-Id": f"{company_id}"
}

n_revisions = 1
page = 1
drawing_revisions = []

while n_revisions > 0:
params = {
"page": page,
"per_page": per_page
}

revision_selection = self.get_request(
api_url=f"{self.endpoint}/projects/{project_id}/drawing_revisions",
additional_headers=headers,
params=params
)

n_revisions = len(revision_selection)
drawing_revisions += revision_selection
page += 1

return drawing_revisions

def show(self, company_id, project_id, drawing_revision_id):
"""
Shows a specific drawing revision

Parameters
----------
company_id : int
unique identifier for the company
project_id : int
unique identifier for the project
drawing_revision_id : int
unique identifier for the drawing revision

Returns
-------
drawing_revision_info : dict
specific drawing revision information
"""
headers = {
"Procore-Company-Id": f"{company_id}"
}

drawing_revision_info = self.get_request(
api_url=f"{self.endpoint}/projects/{project_id}/drawing_revisions/{drawing_revision_id}",
additional_headers=headers
)

return drawing_revision_info
52 changes: 52 additions & 0 deletions ProPyCore/access/drawings/sets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
from ..base import Base
from ...exceptions import NotFoundItemError

class Sets(Base):
def __init__(self, access_token, server_url) -> None:
super().__init__(access_token, server_url)

self.endpoint = "/rest/v1.0"

def get(self, company_id, project_id, per_page=100):
"""
Gets all the available drawing sets

Parameters
----------
company_id : int
unique identifier for the company
project_id : int
unique identifier for the project
per_page : int, default 100
number of drawing sets to include per page

Returns
-------
drawing_sets : list
available drawing sets data
"""
headers = {
"Procore-Company-Id": f"{company_id}"
}

n_sets = 1
page = 1
drawing_sets = []

while n_sets > 0:
params = {
"page": page,
"per_page": per_page
}

set_selection = self.get_request(
api_url=f"{self.endpoint}/projects/{project_id}/drawing_sets",
additional_headers=headers,
params=params
)

n_sets = len(set_selection)
drawing_sets += set_selection
page += 1

return drawing_sets
47 changes: 47 additions & 0 deletions ProPyCore/access/drawings/tiles.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
from ..base import Base

class Tiles(Base):
def __init__(self, access_token, server_url) -> None:
super().__init__(access_token, server_url)

self.endpoint = "/rest/v1.0"

def get(self, company_id, project_id, drawing_revision_id, page=1, per_page=100):
"""
Gets all the available drawing tiles for a specific drawing revision

Parameters
----------
company_id : int
unique identifier for the company
project_id : int
unique identifier for the project
drawing_revision_id : int
unique identifier for the drawing revision
page : int, default 1
page number
per_page : int, default 100
number of drawing tiles to include per page

Returns
-------
drawing_tiles : list
available drawing tiles data
"""
headers = {
"Procore-Company-Id": f"{company_id}"
}

params = {
"project_id": project_id,
"page": page,
"per_page": per_page
}

drawing_tiles = self.get_request(
api_url=f"{self.endpoint}/projects/{project_id}/drawing_revisions/{drawing_revision_id}/drawing_tiles",
additional_headers=headers,
params=params
)

return drawing_tiles
81 changes: 81 additions & 0 deletions ProPyCore/access/drawings/uploads.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
from ..base import Base
from ...exceptions import NotFoundItemError

class Uploads(Base):
def __init__(self, access_token, server_url) -> None:
super().__init__(access_token, server_url)

self.endpoint = "/rest/v1.1"

def get(self, company_id, project_id, per_page=100):
"""
Gets all the available drawing uploads

Parameters
----------
company_id : int
unique identifier for the company
project_id : int
unique identifier for the project
per_page : int, default 100
number of drawing uploads to include per page

Returns
-------
drawing_uploads : list
available drawing uploads data
"""
headers = {
"Procore-Company-Id": f"{company_id}"
}

n_uploads = 1
page = 1
drawing_uploads = []

while n_uploads > 0:
params = {
"page": page,
"per_page": per_page
}

upload_selection = self.get_request(
api_url=f"{self.endpoint}/projects/{project_id}/drawing_uploads",
additional_headers=headers,
params=params
)

n_uploads = len(upload_selection)
drawing_uploads += upload_selection
page += 1

return drawing_uploads

def show(self, company_id, project_id, drawing_upload_id):
"""
Shows a specific drawing upload

Parameters
----------
company_id : int
unique identifier for the company
project_id : int
unique identifier for the project
drawing_upload_id : int
unique identifier for the drawing upload

Returns
-------
drawing_upload_info : dict
specific drawing upload information
"""
headers = {
"Procore-Company-Id": f"{company_id}"
}

drawing_upload_info = self.get_request(
api_url=f"{self.endpoint}/projects/{project_id}/drawing_uploads/{drawing_upload_id}",
additional_headers=headers
)

return drawing_upload_info
4 changes: 3 additions & 1 deletion ProPyCore/access/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def __init__(self, access_token, server_url) -> None:

self.endpoint = "/rest/v1.1/projects"

def get(self, company_id, status="All",per_page=300):
def get(self, company_id, status="All", region=None, per_page=300):
"""
Gets a list of all the projects from a certain company
https://developers.procore.com/reference/rest/projects?version=latest#list-projects
Expand All @@ -24,6 +24,8 @@ def get(self, company_id, status="All",per_page=300):
number of companies to include. Max is 300 per v1.1 API.
status : str enum, default "All"
status of the projects to get must be one of: ["Active", "Inactive", "All"]
region : str or list of str, default None - NOT IMPLMENTED
region of the projects to get

Returns
-------
Expand Down
32 changes: 31 additions & 1 deletion ProPyCore/access/quality/punch.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,34 @@ def show(self, company_id, project_id, punch_id):
params=params
)

return punch_info
return punch_info

def get_assignment(self, company_id, project_id, assignment_id):
"""
Gets a specific punch item assignment

Parameters
----------
company_id : int
unique identifier for the company
project_id : int
unique identifier for the project
assignment_id : int
unique identifier for the punch item assignment

Returns
-------
assignment_info : dict
specific punch item assignment information
"""

headers = {
"Procore-Company-Id": f"{company_id}"
}

assignment_info = self.get_request(
api_url=f"/rest/v1.0/projects/{project_id}/punch_item_assignments/{assignment_id}",
additional_headers=headers
)

return assignment_info
Loading
Loading