本文整理汇总了Python中cachecontrol.CacheControl.headers['Accept']方法的典型用法代码示例。如果您正苦于以下问题:Python CacheControl.headers['Accept']方法的具体用法?Python CacheControl.headers['Accept']怎么用?Python CacheControl.headers['Accept']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cachecontrol.CacheControl
的用法示例。
在下文中一共展示了CacheControl.headers['Accept']方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CacheControl
# 需要导入模块: from cachecontrol import CacheControl [as 别名]
# 或者: from cachecontrol.CacheControl import headers['Accept'] [as 别名]
import laconia
import hyperspace
from rdflib import Graph, URIRef
from django.db import models
from django.contrib.auth.models import User
from django_session_stashable import SessionStashable
from httplib2 import iri2uri
import requests
from cachecontrol import CacheControl
http_client = CacheControl(requests.Session())
http_client.headers['Accept'] = 'text/turtle'
class LaconicModel(models.Model):
iri = models.CharField(max_length=255, unique=True)
def __init__(self, *args, **kwargs):
super(LaconicModel, self).__init__(*args, **kwargs)
graph = Graph()
graph.bind('dbpedia', 'http://dbpedia.org/resource/')
graph.bind('rdfs', 'http://www.w3.org/2000/01/rdf-schema#')
graph.bind('schema', 'http://schema.org/')
home = hyperspace.jump('http://dyli-thingy.herokuapp.com/',
client=http_client)
thing = home.queries['lookup'][0].build({'iri': self.iri}).submit()
graph = graph + thing.data