Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Egnyte connector #3420

Merged
merged 7 commits into from
Dec 11, 2024
Merged

Egnyte connector #3420

merged 7 commits into from
Dec 11, 2024

Conversation

Weves
Copy link
Contributor

@Weves Weves commented Dec 10, 2024

Also adds a new "standard" approach to adding oauth based connectors.

Copy link

vercel bot commented Dec 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
internal-search ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 10, 2024 11:41pm

desired_return_url = f"{WEB_DOMAIN}/admin/connectors/{source}?step=0"
redis_client = get_redis_client(tenant_id=tenant_id)
state = str(uuid.uuid4())
redis_client.set(_OAUTH_STATE_KEY_FMT.format(state=state), desired_return_url)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add expiration

delay: float = 1,
backoff: float = 2,
) -> requests.Response:
@retry(tries=tries, delay=delay, backoff=backoff, logger=cast(Logger, logger))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couple of possible alternative approaches to think about in the future:

  • set urllib3.Retry on the requests object
  • tenacity Retry is better supported nowadays


file_name = file_metadata["name"]
extension = get_file_ext(file_name)
if not check_file_ext_is_valid(extension):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: function naming is a bit redundant ... could be is_valid_file_ext

return DocumentSource.EGNYTE

@classmethod
def redirect_uri(cls, base_domain: str, state: str) -> str:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this method is somewhat confusingly named ... the url being generated is the authorization url for the integration.

current_batch = []

except Exception as e:
logger.error(f"Failed to process file {file['path']}: {str(e)}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logger.exception usually easier to use (implicitly logs exceptions)

@Weves Weves enabled auto-merge December 10, 2024 23:45
@Weves Weves added this pull request to the merge queue Dec 11, 2024
@Weves Weves removed this pull request from the merge queue due to a manual request Dec 11, 2024
@Weves Weves merged commit 4e4214b into main Dec 11, 2024
11 of 13 checks passed
@Weves Weves deleted the egnyte-connector branch December 11, 2024 00:07
aronszanto pushed a commit to aronszanto/onyx that referenced this pull request Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants