-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Egnyte connector #3420
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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) |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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)}") |
There was a problem hiding this comment.
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)
Also adds a new "standard" approach to adding oauth based connectors.