This file contains hidden or 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 json | |
import os | |
from boto3 import Session as AWSSession | |
from requests_aws4auth import AWS4Auth | |
from gql import gql | |
from gql.client import Client | |
from gql.transport.requests import RequestsHTTPTransport |
This file contains hidden or 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
""" | |
Gist code by vstoykov, you can check his original gist at: | |
https://gist.github.com/vstoykov/1390853/5d2e8fac3ca2b2ada8c7de2fb70c021e50927375 | |
Changes: | |
Ignoring static file requests and a certain useless admin request from triggering the logger. | |
Updated statements to make it Python 3 friendly. | |
""" |
This file contains hidden or 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.admin.views.main import ChangeList, ORDER_VAR | |
class NoPkChangeList(ChangeList): | |
def get_ordering(self, request, queryset): | |
""" | |
Returns the list of ordering fields for the change list. | |
First we check the get_ordering() method in model admin, then we check | |
the object's default ordering. Then, any manually-specified ordering | |
from the query string overrides anything. Finally, WE REMOVE the primary | |
key ordering field. |
This file contains hidden or 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 requests | |
import datetime | |
import json | |
from django.core.cache import cache | |
from django.conf import settings | |
GFYCAT_GET_URL = 'https://api.gfycat.com/v1/gfycats/{}' | |
GFYCAT_TOKEN_URL = 'https://api.gfycat.com/v1/oauth/token/' | |
GFYCAT_TOKEN_CACHE_KEY = 'gfycat_token' |