This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SOCIALACCOUNT_PROVIDERS = \ | |
{ | |
'facebook': | |
{'SCOPE': ['email', 'publish_stream'], | |
'AUTH_PARAMS': {'auth_type', 'reauthenticate'}, | |
'METHOD': 'oauth2', | |
'LOCALE_FUNC': 'path_to_callable'}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from crontab import CronTab | |
my_cron = CronTab(user='roy') | |
job = my_cron.new(command='python /home/roy/writeDate.py') | |
job.minute.every(1) | |
my_cron.write() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.gis.geoip2 import GeoIP2 | |
g = GeoIP2() | |
g.country('google.com') | |
# {'country_code': 'US', 'country_name': 'United States'} | |
g.city('72.14.207.99') | |
# {'city': 'Mountain View', | |
# 'continent_code': 'NA', | |
# 'continent_name': 'North America', | |
# 'country_code': 'US', | |
# 'country_name': 'United States', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"listen": "test", | |
"script": { | |
"id": "b7f93d2c-9352-49fa-b97a-c9299fc0e631", | |
"exec": [ | |
"if (pm.request.method === 'POST') {", | |
" pm.test(\"Status code\", function() {", | |
" pm.expect(pm.response.code).to.be.oneOf([201, 400]);", | |
" }) ", | |
"}", | |
"if (pm.request.method === 'GET') {", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REST_FRAMEWORK = { | |
'DEFAULT_AUTHENTICATION_CLASSES': [ | |
'rest_framework_simplejwt.authentication.JWTAuthentication', | |
], | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.urls import path | |
from rest_framework_simplejwt import TokenObtainPairView, TokenRefreshView | |
urlpatterns = [ | |
# Other URLs... | |
path('api/token/', TokenObtainPairView, name='token_obtain_pair'), | |
path('api/token/refresh/', TokenRefreshView, name='token_refresh'), | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export SENDGRID_API_KEY=xxxxxxxxxxxxxxxxxxxxxxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dotenv import load_dotenv | |
load_dotenv() | |
""" | |
Other settings here | |
""" | |
SENDGRID_API_KEY = os.getenv('SENDGRID_API_KEY') | |
SENDGRID_SANDBOX_MODE_IN_DEBUG = False | |
SENDGRID_ECHO_TO_STDOUT = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
import statements | |
""" | |
class RandomView(views.APIView): | |
# other functions | |
def function(self, request, *args, **kwargs): | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.auth.tokens import PasswordResetTokenGenerator | |
class TokenGenerator(PasswordResetTokenGenerator): | |
""" | |
Class for generation token for email confirmation | |
""" | |
def _make_hash_value(self, user, timestamp): |
OlderNewer