-
Notifications
You must be signed in to change notification settings - Fork 0
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
Develop #618
Develop #618
Conversation
…m package upgrade django to 5 and other dependencies refactored deprecated utc import
Add zora constraint
…ter-connection Add twitter_id filed to TwitterConnection
…ter-connection Fix test in twitter constraint
…ter-connection Fix get_twitter_id
…ield Feature/add cloudflare image field
added hcaptcha setup
…ation requirements
fixed migrations
Reviewer's Guide by SourceryThis pull request introduces several significant changes across multiple files, including new features, refactoring, and improvements to existing functionality. The main changes include adding support for HCaptcha, implementing Zora NFT minting verification, updating image handling to use Cloudflare Images, refactoring constraint handling, and making various improvements to models and serializers. File-Level Changes
Tips
|
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.
Hey @PooyaFekri - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding more comprehensive error handling and logging in the new HCaptchaUtil and ZoraUtil classes to improve debugging and monitoring capabilities.
- It might be beneficial to add unit tests for the newly introduced functionality, especially for the Zora NFT minting verification and HCaptcha integration.
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
|
||
|
||
|
||
class HasVerifiedHCaptcha(ConstraintVerification): |
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.
suggestion: Consider extracting common captcha verification logic
The is_observed
method in HasVerifiedHCaptcha
is very similar to the one in HasVerifiedCloudflareCaptcha
. Consider extracting common functionality to a base class or utility function to reduce code duplication.
class BaseCaptchaVerification(ConstraintVerification):
_param_keys = []
app_name = ConstraintApp.GENERAL.value
class HasVerifiedHCaptcha(BaseCaptchaVerification):
pass
from core.thirdpartyapp import config | ||
|
||
|
||
class ZoraUtil: |
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.
suggestion: Enhance Zora API interaction with rate limiting and error handling
Consider implementing rate limiting and more robust error handling in the Zora API interaction to improve reliability and prevent potential issues with external API calls.
class ZoraUtil:
def __init__(self):
self.request = RequestHelper(base_url=config.ZORA_BASE_URL)
self.paths = {"get-address-token-transfer": "api/v2/addresses/{address}/token-transfers"}
self.rate_limiter = RateLimiter(max_calls=100, period=60)
@retry(exceptions=RequestException, tries=3, delay=1, backoff=2)
def make_request(self, method, path, **kwargs):
with self.rate_limiter:
return self.request.request(method, path, **kwargs)
if isinstance(value, str): | ||
return int(value) | ||
|
||
return value |
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.
suggestion (code-quality): We've found these issues:
- Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
)
if isinstance(value, str): | |
return int(value) | |
return value | |
return int(value) if isinstance(value, str) else value |
Summary by Sourcery
Add new constraint verifications for hCaptcha and Zora NFT minting, integrate Cloudflare Images storage, and enhance existing serializers and models. Fix Twitter connection integrity issues and update tests accordingly.
New Features:
HasVerifiedHCaptcha
for verifying hCaptcha tokens.DidMintZoraNFT
to verify if a user has minted a Zora NFT.ZoraUtil
for interacting with the Zora API to check token transfers.Bug Fixes:
twitter_id
field.Enhancements:
is_valid
method in serializers to explicitly pass theraise_exception
parameter.Subgraph
class to usepaths
instead ofpath
for better clarity.Build:
Tests:
image_url
toimage
.Chores: