Content Negotiationを使って、PythonでURIからRDFを取得する
概要 WikidataのエンティティのURIからRDFデータを取得する機会がありましたので、備忘録です。 Content Negotiationを使用しない まず以下のように、headersを空のままリクエストします。 i # u h } # r # i e m r e e f l p U l a S s C s o R d e p h r e r L = e n o e e t p : p t r d n c s e r r f " s i s k p x i i r o h n e i o t n n e r t = g n n t t q t = g s = ( ( u t p { a e t " e h : r i . r e F s e / G e f s e x a t / E q t s t i s W w T u t a p [ l i w e h t o : e k w r s e u n 5 d i . e t s s 0 d w q s r _ e 0 t a i u . e c . 0 o t k e g q o t ] a i s e u d e ) r d t t e e x e e a ( s t t n t t u t = r t a o r = i i . l w e t o t , a 2 v y r h s 0 e g e h 0 i / e s : R n e U a u D n R d c F R t L e c D i r e d F t s s a y = s t f h f a Q e u . r 1 a l m 2 d S a 4 e t t 1 r a 8 s t " ) u s c o d e : " , r e s p o n s e . s t a t u s _ c o d e ) この場合、以下のように、json形式のテキストデータを取得することができます。 ...