Skip to content

Commit

Permalink
Merge pull request #68 from pieces-app/add-headers
Browse files Browse the repository at this point in the history
add headers
  • Loading branch information
bishoy-at-pieces authored Sep 9, 2024
2 parents 971094f + b51746c commit b5687ce
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
run: |
echo "Version: ${{ steps.get_version.outputs.VERSION }}"
poetry version ${{ steps.get_version.outputs.VERSION }}
sed -i "s/__version__ = .*/__version__ = \"${{ steps.get_version.outputs.VERSION }}\"/" __init__.py
sed -i "s/__version__ = .*/__version__ = \"${{ steps.get_version.outputs.VERSION }}\"/" src/pieces_os_client/__init__.py
- name: Build and publish
if: startsWith(github.ref, 'refs/tags/v')
Expand Down
11 changes: 6 additions & 5 deletions src/pieces_os_client/wrapper/basic_identifier/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def raw_content(self) -> Optional[str]:
return preview_raw or fragment_raw or ''

@raw_content.setter
def raw_content(self, content: str) -> str:
def raw_content(self, content: str):
"""
Edit the original format of the asset.
Expand All @@ -86,9 +86,10 @@ def raw_content(self, content: str) -> str:
NotImplemented: If the asset is an image.
"""
format_api = AssetSnapshot.pieces_client.format_api
original = format_api.format_snapshot(self.asset.original.id, transferable=True)
if original.classification.generic == ClassificationGenericEnum.IMAGE:
raise NotImplemented("Can't edit an image yet")
if self.is_image:
original = self._get_ocr_format(self.asset)
else:
original = format_api.format_snapshot(self.asset.original.id, transferable=True)

if original.fragment and original.fragment.string and original.fragment.string.raw:
original.fragment.string.raw = content
Expand Down Expand Up @@ -364,7 +365,7 @@ def _share(asset=None,seed=None):
else:
kwargs = {"seed" : seed}

user = BasicUser.user_profile
user = AssetSnapshot.pieces_client.user.user_profile

if not user:
raise PermissionError("You need to be logged in to generate a shareable link")
Expand Down
4 changes: 2 additions & 2 deletions src/pieces_os_client/wrapper/basic_identifier/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def logout(self):
"""
Logs the user out of the OS.
"""
self.pieces_client.api_client.os_api.sign_out_of_os()
self.pieces_client.os_api.sign_out_of_os()

def connect(self):
"""
Expand All @@ -84,7 +84,7 @@ def disconnect(self):
if not self.user_profile:
raise PermissionError("You must be logged in to use this feature")
if self.user_profile.allocation: # Check if there is an allocation iterable
self.pieces_client.api_client.allocations_api.allocations_disconnect_cloud(self.user_profile.allocation)
self.pieces_client.allocations_api.allocations_disconnect_cloud(self.user_profile.allocation)

@property
def picture(self) -> Optional[str]:
Expand Down
1 change: 1 addition & 0 deletions src/pieces_os_client/wrapper/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def _startup(self) -> bool:

self._is_started_runned = True
self.tracked_application = self.connector_api.connect(seeded_connector_connection=self._seeded_connector).application
self.api_client.set_default_header("application",self.tracked_application.id)

if self._connect_websockets:
self.conversation_ws = ConversationWS(self)
Expand Down

0 comments on commit b5687ce

Please sign in to comment.