Skip to content

Instantly share code, notes, and snippets.

View Allwin12's full-sized avatar

Allwin Raju Allwin12

  • Genesys
  • chennai
View GitHub Profile
class SampleView(APIView):
def get(self, request):
token = request.META.get('HTTP_AUTHORIZATION')
access_token = token.split()[-1]
print(access_token)
return Response({'token': access_token})
import requests
import pkg_resources
from bs4 import BeautifulSoup
from pkg_resources import parse_version
from subprocess import call
base_url = "https://pypi.org/project/"
for pkg in pkg_resources.working_set:
original_version = pkg.version
import re
import matplotlib.pyplot as plt
with open('chat.txt', 'r') as f:
content = f.readlines()
all_dates = []
for line in content:
dates = re.findall(r'[0-9]+/[0-9]+/[0-9]+', line)
if dates:
from captcha.image import ImageCaptcha
import string
import random
text = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(10))
image = ImageCaptcha()
data = image.generate(text)
image.write(text, 'captcha.png')
{
"search_result": [
{
"index": 0,
"id": "PLhe6bv3puIj1r64ot4k76YkGhJpFdhCxU",
"link": "https://www.youtube.com/playlist?list=PLhe6bv3puIj1r64ot4k76YkGhJpFdhCxU",
"title": "All Coldplay Songs"
},
{
"index": 1,
{
"search_result": [
{
"index": 0,
"id": "PLhe6bv3puIj1r64ot4k76YkGhJpFdhCxU",
"link": "https://www.youtube.com/playlist?list=PLhe6bv3puIj1r64ot4k76YkGhJpFdhCxU",
"title": "All Coldplay Songs"
},
{
"index": 1,
{
"search_result": [
{
"index": 0,
"id": "kJQP7kiw5Fk",
"link": "https://www.youtube.com/watch?v=kJQP7kiw5Fk",
"title": "Luis Fonsi - Despacito ft. Daddy Yankee",
"channel": "Luis Fonsi",
"duration": "4:42",
"views": 6874955394,
from rest_framework.response import Response
from rest_framework.views import APIView
class AuthTest(APIView):
def get(self, request):
try:
username = "User@123"
password = "htd61m12;!@"
auth_header = request.META.get('HTTP_AUTHORIZATION', '')
import pkg_resources
from subprocess import call
packages = []
for pkg in pkg_resources.working_set:
packages.append(pkg.project_name)
call("pip install --upgrade " + ''.join(packages), shell=True)
Student.objects.filter(is_active=False).update(is_active=True)