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
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# Changelog

## [0.6.2] - 2025-05-13
## [0.6.3] - 2025-05-13

### Added
* `documents.files`: add `view` parameter to `get()` and `search()` methods
* `documents.files`: add `file_types` parameter to `get()` and `search()` methods
* `documents.files`: add `private` parameter to `get()` method

### Changed
* `base`: remove debug print statements

## [0.6.1] - 2025-05-07

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.6.2"
__version__ = "0.6.3"
7 changes: 1 addition & 6 deletions ProPyCore/access/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,14 @@ def get_request(self, api_url, additional_headers=None, params=None):
if params is None:
url = self.__server_url + api_url
else:
url = self.__server_url + api_url + "?" + urllib.parse.urlencode(params)
url = self.__server_url + api_url + "?" + urllib.parse.urlencode(params, doseq=True)

headers = {"Authorization": f"Bearer {self.__access_token}"}
if additional_headers is not None:
for key, value in additional_headers.items():
headers[key] = value

response = requests.get(url, headers=headers)
'''
print(f"Request URL: {response.request.url}")
print(f"Request Headers: {response.request.headers}")
print(f"Request Response: {response.json()}")
'''

if response.ok:
return response.json()
Expand Down
12 changes: 10 additions & 2 deletions ProPyCore/access/documents/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def remove(self, company_id, project_id, doc_id):

return doc_info

def get(self, company_id, project_id, folder_id=None, view="normal"):
def get(self, company_id, project_id, folder_id=None, view="normal", file_types=None):
"""
Gets all documents in a project.

Expand All @@ -239,6 +239,8 @@ def get(self, company_id, project_id, folder_id=None, view="normal"):
ID of parent folder.
view : str, default "normal"
View to use for the request: "normal" or "extended"
file_types : list of str, default None
List of file type extensions to filter by.

Returns
-------
Expand All @@ -258,9 +260,12 @@ def get(self, company_id, project_id, folder_id=None, view="normal"):
"per_page": 10000,
"filters[document_type]": doc_type,
"filters[is_in_recycle_bin]": False,
"filters[private]": False,
}
if folder_id is not None:
params["filters[folder_id]"] = folder_id
if file_types is not None:
params["filters[file_type]"] = file_types

headers = {
"Procore-Company-Id": f"{company_id}",
Expand Down Expand Up @@ -288,7 +293,7 @@ def get(self, company_id, project_id, folder_id=None, view="normal"):
f"from Parent ID {folder_id if folder_id is not None else 'Root'}",
)

def search(self, company_id, project_id, value, folder_id=None, view="normal"):
def search(self, company_id, project_id, value, folder_id=None, view="normal", file_types=[]):
"""
Searches through all available files to find the closest match to the given value.

Expand All @@ -302,6 +307,8 @@ def search(self, company_id, project_id, value, folder_id=None, view="normal"):
Search criteria.
folder_id : int, default None
ID of parent folder.
file_types : list of str, default []
List of file type extensions to filter by.

Returns
-------
Expand All @@ -313,6 +320,7 @@ def search(self, company_id, project_id, value, folder_id=None, view="normal"):
project_id=project_id,
folder_id=folder_id,
view=view,
file_types=file_types,
)

doc_type = self.endpoint.split("/")[-1][:-1]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

setup(
name="ProPyCore",
version="0.6.2",
version="0.6.3",
author="Hagen E. Fritz",
author_email="hfritz@r-o.com",
description="Interact with Procore through Python for data connection applications",
Expand Down
Loading
Loading