damewebutils 0.2.3__tar.gz → 0.2.3.post1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/PKG-INFO +19 -2
  2. damewebutils-0.2.3.post1/damewebutils/files/tests/davidam-index-2026-04-13-14.txt +142 -0
  3. damewebutils-0.2.3.post1/damewebutils/files/tests/davidam-index-2026-04-17-14.txt +132 -0
  4. damewebutils-0.2.3.post1/damewebutils/tests/__pycache__/test_cookies.cpython-314-pytest-9.0.1.pyc +0 -0
  5. damewebutils-0.2.3.post1/damewebutils/tests/__pycache__/test_requests.cpython-314-pytest-9.0.1.pyc +0 -0
  6. damewebutils-0.2.3.post1/damewebutils/tests/__pycache__/test_wikidata.cpython-314-pytest-9.0.1.pyc +0 -0
  7. damewebutils-0.2.3.post1/damewebutils/tests/__pycache__/test_xml.cpython-314-pytest-9.0.1.pyc +0 -0
  8. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils/tests/test_cookies.py +7 -7
  9. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils/tests/test_requests.py +14 -14
  10. damewebutils-0.2.3.post1/damewebutils/tests/test_wikidata.py +180 -0
  11. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils.egg-info/PKG-INFO +19 -2
  12. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils.egg-info/SOURCES.txt +7 -9
  13. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/setup.py +2 -2
  14. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/testsbycommands.sh +21 -21
  15. damewebutils-0.2.3/damewebutils/files/tests/dameimgs.txt +0 -89
  16. damewebutils-0.2.3/damewebutils/tests/test_wikidata.py +0 -179
  17. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/LICENSE +0 -0
  18. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/README.md +0 -0
  19. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/dameimgs.py +0 -0
  20. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damejson.py +0 -0
  21. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damerss.py +0 -0
  22. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/dameserver.py +0 -0
  23. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/dameurls.py +0 -0
  24. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils/app/TCPClient.py +0 -0
  25. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils/app/TCPServer.py +0 -0
  26. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils/files/document.xml +0 -0
  27. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils/files/foaf.rdf +0 -0
  28. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils/files/index.xhtml +0 -0
  29. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils/files/items.xml +0 -0
  30. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils/files/output.xhtml +0 -0
  31. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils/files/rss.xml +0 -0
  32. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils/files/source.xml +0 -0
  33. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils/files/tests/damegender-imgs.txt +0 -0
  34. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils/files/tests/damegender-rss.txt +0 -0
  35. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils/files/tests/data3.txt +0 -0
  36. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils/files/tests/davidam-index.txt +0 -0
  37. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils/files/tests/github-davidam.txt +0 -0
  38. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils/files/tests/template.txt +0 -0
  39. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils/files/tree_created.xml +0 -0
  40. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils/tests/test_xml.py +0 -0
  41. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils.egg-info/dependency_links.txt +0 -0
  42. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils.egg-info/not-zip-safe +0 -0
  43. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils.egg-info/requires.txt +0 -0
  44. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/damewebutils.egg-info/top_level.txt +0 -0
  45. {damewebutils-0.2.3 → damewebutils-0.2.3.post1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: damewebutils
3
- Version: 0.2.3
3
+ Version: 0.2.3.post1
4
4
  Summary: Web utils for Python
5
5
  Home-page: http://github.com/davidam/damewebutils
6
6
  Author: David Arroyo Menéndez
@@ -13,6 +13,23 @@ Classifier: Programming Language :: Python :: 3.6
13
13
  Classifier: Topic :: Text Processing :: Linguistic
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE
16
+ Requires-Dist: SPARQLWrapper
17
+ Requires-Dist: rdflib
18
+ Requires-Dist: markdown
19
+ Requires-Dist: requests
20
+ Requires-Dist: cssselect
21
+ Requires-Dist: lxml
22
+ Dynamic: author
23
+ Dynamic: author-email
24
+ Dynamic: classifier
25
+ Dynamic: description
26
+ Dynamic: description-content-type
27
+ Dynamic: home-page
28
+ Dynamic: keywords
29
+ Dynamic: license
30
+ Dynamic: license-file
31
+ Dynamic: requires-dist
32
+ Dynamic: summary
16
33
 
17
34
  <div id="table-of-contents">
18
35
  <h2>Table of Contents</h2>
@@ -0,0 +1,142 @@
1
+ http://www.davidam.com/#hero
2
+ http://www.davidam.com/#about
3
+ http://www.davidam.com/#portfolio
4
+ http://www.davidam.com/#readme
5
+ https://twitter.com/davidam9
6
+ https://www.instagram.com/davidam9rn/
7
+ https://www.youtube.com/@davidarroyomenendez6969/
8
+ https://www.linkedin.com/in/david-arroyo-men%C3%A9ndez-60064512/
9
+ https://www.davidam.com
10
+ https://github.com/davidam
11
+ https://www.youtube.com/watch?v=Qvlxkc9BQqs
12
+ https://scholar.google.es/citations?user=znKwqIMAAAAJ&hl=es
13
+ https://scholar.google.es/citations?user=znKwqIMAAAAJ&hl=es&oi=ao
14
+ https://github.com/davidam
15
+ https://www.tiobe.com/tiobe-index/
16
+ https://tv.urjc.es/video/5dc20907d68b14fc478c0d4f
17
+ https://tv.urjc.es/video/5db8d952d68b14b61c8ba79c
18
+ https://tv.urjc.es/video/5daf1c73d68b14d9028b4c9a
19
+ http://www.davidam.com/assets/img/portfolio/fuentes-del-encinar.png
20
+ http://www.davidam.com/assets/img/portfolio/damegender.png
21
+ http://www.davidam.com/assets/img/portfolio/innova.png
22
+ http://www.davidam.com/assets/img/portfolio/imi.png
23
+ http://www.davidam.com/assets/img/portfolio/voluntarios-telefonica.jpg
24
+ http://www.davidam.com/assets/img/portfolio/damelibraries.png
25
+ http://www.davidam.com/assets/img/portfolio/iddeasp.png
26
+ http://www.davidam.com/assets/img/portfolio/neomed.png
27
+ http://www.davidam.com/assets/img/portfolio/alagua.png
28
+ http://www.davidam.com/assets/img/portfolio/idoctus.png
29
+ http://www.davidam.com/assets/img/portfolio/ess-front.png
30
+ http://www.davidam.com/
31
+ http://www.davidam.com/
32
+ https://github.com/davidam/sql-examples
33
+ https://github.com/davidam/php-examples
34
+ https://github.com/davidam/js-examples
35
+ https://github.com/davidam/jquery-examples
36
+ https://github.com/davidam/bootstrap-examples
37
+ https://github.com/davidam/casperjs-examples
38
+ https://github.com/davidam/angular-examples
39
+ https://github.com/davidam/jest-examples
40
+ https://github.com/davidam/nodejs-examples
41
+ https://www.drupal.org/u/davidam
42
+ https://github.com/davidam/davidam
43
+ https://damegender.davidam.com
44
+ https://damelibraries.davidam.com
45
+ https://damewebutils.davidam.com
46
+ http://www.davidam.com/
47
+ https://scholar.google.es/citations?user=znKwqIMAAAAJ&hl=es
48
+ https://scholar.google.es/citations?view_op=view_citation&hl=es&user=znKwqIMAAAAJ&citation_for_view=znKwqIMAAAAJ:Se3iqnhoufwC
49
+ https://scholar.google.es/citations?view_op=view_citation&hl=es&user=znKwqIMAAAAJ&citation_for_view=znKwqIMAAAAJ:roLk4NBRz8UC
50
+ https://scholar.google.es/citations?view_op=view_citation&hl=es&user=znKwqIMAAAAJ&citation_for_view=znKwqIMAAAAJ:kNdYIx-mwKoC
51
+ https://scholar.google.es/citations?view_op=view_citation&hl=es&user=znKwqIMAAAAJ&citation_for_view=znKwqIMAAAAJ:8d8msizDQcsC
52
+ https://doi.org/10.18848/2474-6029/CGP/v11i02/67-82
53
+ https://scholar.google.es/citations?view_op=view_citation&hl=es&user=znKwqIMAAAAJ&citation_for_view=znKwqIMAAAAJ:0izLItjtcgwC
54
+ https://github.com/davidam/damegender/blob/master/articles/damegender-dataset.pdf
55
+ https://www.youtube.com/watch?v=LIVwTjufB10&list=PLeobXV-Yyn-LoUt3qv9DL2odc_qrq5kXk
56
+ https://twitter.com/davidam9
57
+ https://www.instagram.com/davidam9rn/
58
+ https://www.youtube.com/@davidarroyomenendez6969/
59
+ https://www.linkedin.com/in/david-arroyo-men%C3%A9ndez-60064512/
60
+ https://bootstrapmade.com/
61
+ http://www.davidam.com/#
62
+ http://www.davidam.com/#hero
63
+ 200
64
+ http://www.davidam.com/#about
65
+ 200
66
+ http://www.davidam.com/#portfolio
67
+ 200
68
+ http://www.davidam.com/#readme
69
+ 200
70
+ https://twitter.com/davidam9
71
+ 200
72
+ https://www.instagram.com/davidam9rn/
73
+ 200
74
+ https://www.youtube.com/@davidarroyomenendez6969/
75
+ 200
76
+ https://www.linkedin.com/in/david-arroyo-men%C3%A9ndez-60064512/
77
+ 999
78
+ https://www.davidam.com
79
+ 200
80
+ https://github.com/davidam
81
+ 200
82
+ https://www.youtube.com/watch?v=Qvlxkc9BQqs
83
+ 200
84
+ https://scholar.google.es/citations?user=znKwqIMAAAAJ&hl=es
85
+ Error
86
+ https://scholar.google.es/citations?user=znKwqIMAAAAJ&hl=es&oi=ao
87
+ Error
88
+ https://github.com/davidam
89
+ 200
90
+ https://www.tiobe.com/tiobe-index/
91
+ 200
92
+ https://tv.urjc.es/video/5dc20907d68b14fc478c0d4f
93
+ 200
94
+ https://tv.urjc.es/video/5db8d952d68b14b61c8ba79c
95
+ 200
96
+ https://tv.urjc.es/video/5daf1c73d68b14d9028b4c9a
97
+ 200
98
+ http://www.davidam.com/assets/img/portfolio/fuentes-del-encinar.png
99
+ 200
100
+ http://www.davidam.com/assets/img/portfolio/damegender.png
101
+ 200
102
+ http://www.davidam.com/assets/img/portfolio/innova.png
103
+ 200
104
+ http://www.davidam.com/assets/img/portfolio/imi.png
105
+ 200
106
+ http://www.davidam.com/assets/img/portfolio/voluntarios-telefonica.jpg
107
+ 200
108
+ http://www.davidam.com/assets/img/portfolio/damelibraries.png
109
+ 200
110
+ http://www.davidam.com/assets/img/portfolio/iddeasp.png
111
+ 200
112
+ http://www.davidam.com/assets/img/portfolio/neomed.png
113
+ 200
114
+ http://www.davidam.com/assets/img/portfolio/alagua.png
115
+ 200
116
+ http://www.davidam.com/assets/img/portfolio/idoctus.png
117
+ 200
118
+ http://www.davidam.com/assets/img/portfolio/ess-front.png
119
+ 200
120
+ http://www.davidam.com/
121
+ 200
122
+ http://www.davidam.com/
123
+ 200
124
+ https://github.com/davidam/sql-examples
125
+ 200
126
+ https://github.com/davidam/php-examples
127
+ 200
128
+ https://github.com/davidam/js-examples
129
+ 200
130
+ https://github.com/davidam/jquery-examples
131
+ 200
132
+ https://github.com/davidam/bootstrap-examples
133
+ 200
134
+ https://github.com/davidam/casperjs-examples
135
+ Error
136
+ https://github.com/davidam/angular-examples
137
+ 200
138
+ https://github.com/davidam/jest-examples
139
+ 200
140
+ https://github.com/davidam/nodejs-examples
141
+ 200
142
+ https://www.drupal.org/u/davidam
@@ -0,0 +1,132 @@
1
+ http://www.davidam.com/#hero
2
+ http://www.davidam.com/#about
3
+ http://www.davidam.com/#portfolio
4
+ http://www.davidam.com/#readme
5
+ https://twitter.com/davidam9
6
+ https://www.instagram.com/davidam9rn/
7
+ https://www.youtube.com/@davidarroyomenendez6969/
8
+ https://www.linkedin.com/in/david-arroyo-men%C3%A9ndez-60064512/
9
+ https://www.davidam.com
10
+ https://github.com/davidam
11
+ https://www.youtube.com/watch?v=Qvlxkc9BQqs
12
+ https://scholar.google.es/citations?user=znKwqIMAAAAJ&hl=es
13
+ https://scholar.google.es/citations?user=znKwqIMAAAAJ&hl=es&oi=ao
14
+ https://github.com/davidam
15
+ https://www.tiobe.com/tiobe-index/
16
+ https://tv.urjc.es/video/5dc20907d68b14fc478c0d4f
17
+ https://tv.urjc.es/video/5db8d952d68b14b61c8ba79c
18
+ https://tv.urjc.es/video/5daf1c73d68b14d9028b4c9a
19
+ http://www.davidam.com/assets/img/portfolio/fuentes-del-encinar.png
20
+ http://www.davidam.com/assets/img/portfolio/damegender.png
21
+ http://www.davidam.com/assets/img/portfolio/innova.png
22
+ http://www.davidam.com/assets/img/portfolio/imi.png
23
+ http://www.davidam.com/assets/img/portfolio/voluntarios-telefonica.jpg
24
+ http://www.davidam.com/assets/img/portfolio/damelibraries.png
25
+ http://www.davidam.com/assets/img/portfolio/iddeasp.png
26
+ http://www.davidam.com/assets/img/portfolio/neomed.png
27
+ http://www.davidam.com/assets/img/portfolio/alagua.png
28
+ http://www.davidam.com/assets/img/portfolio/idoctus.png
29
+ http://www.davidam.com/assets/img/portfolio/ess-front.png
30
+ http://www.davidam.com/
31
+ http://www.davidam.com/
32
+ https://github.com/davidam/sql-examples
33
+ https://github.com/davidam/php-examples
34
+ https://github.com/davidam/js-examples
35
+ https://github.com/davidam/jquery-examples
36
+ https://github.com/davidam/bootstrap-examples
37
+ https://github.com/davidam/casperjs-examples
38
+ https://github.com/davidam/angular-examples
39
+ https://github.com/davidam/jest-examples
40
+ https://github.com/davidam/nodejs-examples
41
+ https://www.drupal.org/u/davidam
42
+ https://github.com/davidam/davidam
43
+ https://damegender.davidam.com
44
+ https://damelibraries.davidam.com
45
+ https://damewebutils.davidam.com
46
+ http://www.davidam.com/
47
+ https://scholar.google.es/citations?user=znKwqIMAAAAJ&hl=es
48
+ https://scholar.google.es/citations?view_op=view_citation&hl=es&user=znKwqIMAAAAJ&citation_for_view=znKwqIMAAAAJ:Se3iqnhoufwC
49
+ https://scholar.google.es/citations?view_op=view_citation&hl=es&user=znKwqIMAAAAJ&citation_for_view=znKwqIMAAAAJ:roLk4NBRz8UC
50
+ https://scholar.google.es/citations?view_op=view_citation&hl=es&user=znKwqIMAAAAJ&citation_for_view=znKwqIMAAAAJ:kNdYIx-mwKoC
51
+ https://scholar.google.es/citations?view_op=view_citation&hl=es&user=znKwqIMAAAAJ&citation_for_view=znKwqIMAAAAJ:8d8msizDQcsC
52
+ https://doi.org/10.18848/2474-6029/CGP/v11i02/67-82
53
+ https://scholar.google.es/citations?view_op=view_citation&hl=es&user=znKwqIMAAAAJ&citation_for_view=znKwqIMAAAAJ:0izLItjtcgwC
54
+ https://github.com/davidam/damegender/blob/master/articles/damegender-dataset.pdf
55
+ https://www.youtube.com/watch?v=LIVwTjufB10&list=PLeobXV-Yyn-LoUt3qv9DL2odc_qrq5kXk
56
+ https://twitter.com/davidam9
57
+ https://www.instagram.com/davidam9rn/
58
+ https://www.youtube.com/@davidarroyomenendez6969/
59
+ https://www.linkedin.com/in/david-arroyo-men%C3%A9ndez-60064512/
60
+ https://bootstrapmade.com/
61
+ http://www.davidam.com/#
62
+ http://www.davidam.com/#hero
63
+ 200
64
+ http://www.davidam.com/#about
65
+ 200
66
+ http://www.davidam.com/#portfolio
67
+ 200
68
+ http://www.davidam.com/#readme
69
+ 200
70
+ https://twitter.com/davidam9
71
+ 200
72
+ https://www.instagram.com/davidam9rn/
73
+ 200
74
+ https://www.youtube.com/@davidarroyomenendez6969/
75
+ 200
76
+ https://www.linkedin.com/in/david-arroyo-men%C3%A9ndez-60064512/
77
+ 999
78
+ https://www.davidam.com
79
+ 200
80
+ https://github.com/davidam
81
+ 200
82
+ https://www.youtube.com/watch?v=Qvlxkc9BQqs
83
+ 200
84
+ https://scholar.google.es/citations?user=znKwqIMAAAAJ&hl=es
85
+ Error
86
+ https://scholar.google.es/citations?user=znKwqIMAAAAJ&hl=es&oi=ao
87
+ Error
88
+ https://github.com/davidam
89
+ 200
90
+ https://www.tiobe.com/tiobe-index/
91
+ 200
92
+ https://tv.urjc.es/video/5dc20907d68b14fc478c0d4f
93
+ 200
94
+ https://tv.urjc.es/video/5db8d952d68b14b61c8ba79c
95
+ 200
96
+ https://tv.urjc.es/video/5daf1c73d68b14d9028b4c9a
97
+ 200
98
+ http://www.davidam.com/assets/img/portfolio/fuentes-del-encinar.png
99
+ 200
100
+ http://www.davidam.com/assets/img/portfolio/damegender.png
101
+ 200
102
+ http://www.davidam.com/assets/img/portfolio/innova.png
103
+ 200
104
+ http://www.davidam.com/assets/img/portfolio/imi.png
105
+ 200
106
+ http://www.davidam.com/assets/img/portfolio/voluntarios-telefonica.jpg
107
+ 200
108
+ http://www.davidam.com/assets/img/portfolio/damelibraries.png
109
+ 200
110
+ http://www.davidam.com/assets/img/portfolio/iddeasp.png
111
+ 200
112
+ http://www.davidam.com/assets/img/portfolio/neomed.png
113
+ 200
114
+ http://www.davidam.com/assets/img/portfolio/alagua.png
115
+ 200
116
+ http://www.davidam.com/assets/img/portfolio/idoctus.png
117
+ 200
118
+ http://www.davidam.com/assets/img/portfolio/ess-front.png
119
+ 200
120
+ http://www.davidam.com/
121
+ 200
122
+ http://www.davidam.com/
123
+ 200
124
+ https://github.com/davidam/sql-examples
125
+ 200
126
+ https://github.com/davidam/php-examples
127
+ 200
128
+ https://github.com/davidam/js-examples
129
+ 200
130
+ https://github.com/davidam/jquery-examples
131
+ 200
132
+ https://github.com/davidam/bootstrap-examples
@@ -72,10 +72,10 @@ class TestCookies(TestCase):
72
72
  self.assertEqual(C["number"].value, '7')
73
73
  self.assertEqual(C["string"].value, "seven")
74
74
 
75
- def test_session(self):
76
- s = requests.Session()
77
- s.get('http://httpbin.org/cookies/set/sessioncookie/123456789')
78
- r = s.get("http://httpbin.org/cookies")
79
- str1 = '{\n "cookies": {\n '
80
- str1 = str1 + '"sessioncookie": "123456789"\n }\n}\n'
81
- self.assertEqual(r.text, str1)
75
+ # def test_session(self):
76
+ # s = requests.Session()
77
+ # s.get('http://httpbin.org/cookies/set/sessioncookie/123456789')
78
+ # r = s.get("http://httpbin.org/cookies")
79
+ # str1 = '{\n "cookies": {\n '
80
+ # str1 = str1 + '"sessioncookie": "123456789"\n }\n}\n'
81
+ # self.assertEqual(r.text, str1)
@@ -35,17 +35,17 @@ class TestRequests(TestCase):
35
35
  r = requests.get(u)
36
36
  self.assertEqual(r.status_code, 200)
37
37
  self.assertEqual(r.url, u)
38
- r = requests.post('https://httpbin.org/post', data={'key': 'value'})
39
- print(r.text)
40
- j = '{\n "args": {}, \n "data": "", '
41
- j = '\n "files": {}, \n "form": {\n "key":'
42
- j = j + '"value"\n }, \n "headers": '
43
- j = j + '{\n "Accept": "*/*", \n "Accept-Encoding":'
44
- j = j + '"gzip, deflate", \n "Content-Length": "9", \n "Content-Type":'
45
- j = j + '"application/x-www-form-urlencoded",'
46
- j = j + '\n "Host": "httpbin.org", \n'
47
- j = j + '"User-Agent": "python-requests/2.18.4",'
48
- j = j + '\n "X-Amzn-Trace-Id": '
49
- self.assertTrue("x-www-form-urlencoded" in r.text)
50
- self.assertEqual(r.raise_for_status(), None)
51
- self.assertEqual('true', r.headers['Access-Control-Allow-Credentials'])
38
+ # r = requests.post('https://httpbin.org/post', data={'key': 'value'})
39
+ # print(r.text)
40
+ # j = '{\n "args": {}, \n "data": "", '
41
+ # j = '\n "files": {}, \n "form": {\n "key":'
42
+ # j = j + '"value"\n }, \n "headers": '
43
+ # j = j + '{\n "Accept": "*/*", \n "Accept-Encoding":'
44
+ # j = j + '"gzip, deflate", \n "Content-Length": "9", \n "Content-Type":'
45
+ # j = j + '"application/x-www-form-urlencoded",'
46
+ # j = j + '\n "Host": "httpbin.org", \n'
47
+ # j = j + '"User-Agent": "python-requests/2.18.4",'
48
+ # j = j + '\n "X-Amzn-Trace-Id": '
49
+ # self.assertTrue("x-www-form-urlencoded" in r.text)
50
+ # self.assertEqual(r.raise_for_status(), None)
51
+ # self.assertEqual('true', r.headers['Access-Control-Allow-Credentials'])
@@ -0,0 +1,180 @@
1
+ #!/usr/bin/python
2
+ # -*- coding: utf-8 -*-
3
+
4
+ # Copyright (C) 2020 David Arroyo Menéndez
5
+
6
+ # Author: David Arroyo Menéndez <davidam@gnu.org>
7
+ # Maintainer: David Arroyo Menéndez <davidam@gnu.org>
8
+
9
+ # This file is free software; you can redistribute it and/or modify
10
+ # it under the terms of the GNU General Public License as published by
11
+ # the Free Software Foundation; either version 3, or (at your option)
12
+ # any later version.
13
+
14
+ # This file is distributed in the hope that it will be useful,
15
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ # GNU General Public License for more details.
18
+
19
+ # You should have received a copy of the GNU General Public License
20
+ # along with damewebutils; see the file LICENSE. If not, write to
21
+ # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22
+ # Boston, MA 02110-1301 USA,
23
+
24
+ from unittest import TestCase
25
+ from SPARQLWrapper import SPARQLWrapper, JSON
26
+ import requests
27
+
28
+
29
+ class TestWikidata(TestCase):
30
+
31
+ def test_dbpedia_asturias(self):
32
+ sparql = SPARQLWrapper("http://dbpedia.org/sparql")
33
+ sparql.setQuery("""
34
+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
35
+ SELECT ?label
36
+ WHERE { <http://dbpedia.org/resource/Asturias> rdfs:label ?label }
37
+ """)
38
+ sparql.setReturnFormat(JSON)
39
+ results = sparql.query().convert()
40
+
41
+ l1 = []
42
+ for result in results["results"]["bindings"]:
43
+ l1.append(result["label"]["value"])
44
+ self.assertEqual(l1[0], 'Asturias')
45
+
46
+ # def test_surnames(self):
47
+ # url = 'https://query.wikidata.org/sparql'
48
+ # query = """
49
+ # SELECT ?surname ?surnameLabel ?count
50
+ # WHERE
51
+ # {
52
+ # {
53
+ # SELECT ?surname (COUNT(?human) AS ?count) WHERE {
54
+ # # ?human wdt:P31 wd:Q5.
55
+ # ?human wdt:P734 ?surname.
56
+ # }
57
+ # GROUP BY ?surname ORDER BY DESC(?count) LIMIT 2
58
+ # }
59
+ # SERVICE wikibase:label
60
+ # { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
61
+ # }
62
+ # ORDER BY DESC(?count)
63
+ # LIMIT 2
64
+ # # limit to 10 results so we don't timeout
65
+ # """
66
+ # r = requests.get(url, params={'format': 'json', 'query': query})
67
+ # data = r.json()
68
+ # l1 = []
69
+ # for result in data["results"]["bindings"]:
70
+ # elem = [result['surnameLabel']['value'], result['count']['value']]
71
+ # l1.append(elem[0])
72
+ # self.assertEqual(l1, ['Li', 'Wang'])
73
+
74
+ # def test_openstreetmap(self):
75
+ # # https://www.wikidata.org/wiki/Wikidata:OpenStreetMap
76
+ # url = 'https://query.wikidata.org/sparql'
77
+ # query = """
78
+ # SELECT ?itemLabel ?item ?OSM ?code
79
+ # WHERE
80
+ # {
81
+ # ?item wdt:P31 wd:Q6465 . #French départements
82
+ # ?item wdt:P300 ?code . #with ISO 3166-2 code
83
+ # OPTIONAL { ?item wdt:P402 ?OSM }. #OSM relation if available
84
+ # SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" }
85
+ # }
86
+ # """
87
+ # dicc1 = {'format': 'json', 'query': query}
88
+ # r = requests.get(url, params=dicc1)
89
+ # data = r.json()
90
+ # l1 = []
91
+ # vector = data['results']['bindings'][0]
92
+ # values = [vector['code']['value'],
93
+ # vector['OSM']['value'],
94
+ # vector['itemLabel']['value'],
95
+ # vector['item']['value']]
96
+ # arr1 = ['FR-44', '7432', 'Loire-Atlantique',
97
+ # 'http://www.wikidata.org/entity/Q3068']
98
+ # self.assertEqual(values, arr1)
99
+
100
+ # def test_conan_doyle(self):
101
+ # # https://www.wikidata.org/wiki/Wikidata:SPARQL_tutorial#Arthur_Conan_Doyle_books
102
+ # url = 'https://query.wikidata.org/sparql'
103
+ # query = """
104
+ # SELECT ?book ?bookLabel
105
+ # WHERE
106
+ # {
107
+ # ?book wdt:P50 wd:Q35610.
108
+ # SERVICE wikibase:label
109
+ # { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
110
+ # }
111
+ # ORDER BY DESC(?book)
112
+ # LIMIT 2
113
+ # """
114
+ # dicc = {'format': 'json', 'query': query}
115
+ # r = requests.get(url, params=dicc)
116
+ # data = r.json()
117
+ # # print(data['results']['bindings'][0]['bookLabel'])
118
+ # arr1 = data['results']['bindings'][0]['bookLabel']
119
+ # dicc1 = {'type': 'literal', 'value': 'Q45192'}
120
+ # self.assertEqual(arr1, dicc1)
121
+
122
+ # def test_ue(self):
123
+ # # https://towardsdatascience.com/a-brief-introduction-to-wikidata-bb4e66395eb1
124
+ # url = 'https://query.wikidata.org/sparql'
125
+ # query = """
126
+ # SELECT ?country ?countryLabel ?capitalLabel ?population
127
+ # WHERE
128
+ # {
129
+ # ?country wdt:P463 wd:Q458.
130
+ # ?country wdt:P36 ?capital.
131
+ # ?capital wdt:P1082 ?population.
132
+ # SERVICE wikibase:label
133
+ # { bd:serviceParam wikibase:language " [AUTO_LANGUAGE],en". }
134
+ # }
135
+ # ORDER BY DESC(?capital)
136
+ # """
137
+ # dicc1 = {'format': 'json', 'query': query}
138
+ # r = requests.get(url, params=dicc1)
139
+ # data = r.json()
140
+ # arr1 = data['results']['bindings'][0]['countryLabel']['value']
141
+ # val1 = "Kingdom of the Netherlands"
142
+ # self.assertEqual(arr1, val1)
143
+
144
+ # def test_cervantes(self):
145
+ # # http://www.cervantesvirtual.com/obra/la-serrana-de-la-vera--0/
146
+ # url = 'https://query.wikidata.org/sparql'
147
+ # query = """
148
+ # SELECT ?workLabel WHERE {
149
+ # wd:Q165257 wdt:P2799 ?id
150
+ # BIND(uri(concat("http://data.cervantesvirtual.com/person/", ?id)) as ?bvmcID)
151
+ # SERVICE <http://data.cervantesvirtual.com/openrdf-sesame/repositories/data> {
152
+ # ?bvmcID <http://rdaregistry.info/Elements/a/authorOf> ?work .
153
+ # ?work rdfs:label ?workLabel
154
+ # }
155
+ # }
156
+ # ORDER BY (?id)
157
+ # """
158
+ # dicc = {'format': 'json', 'query': query}
159
+ # r = requests.get(url, params=dicc)
160
+ # data = r.json()
161
+ # arr1 = data['results']['bindings'][0]
162
+ # dicc2 = {'workLabel': {'type': 'literal',
163
+ # 'value': 'El príncipe inocente : comedia'}}
164
+ # self.assertEqual(arr1, dicc2)
165
+
166
+ # def test_number_of_computer_types(self):
167
+ # url = 'https://query.wikidata.org/sparql'
168
+ # query = """
169
+ # SELECT (count(*) as ?instances) WHERE {
170
+ # # Instance has a type of home computers
171
+ # ?instance wdt:P31 wd:Q473708
172
+ # }
173
+ # """
174
+ # dicc = {'format': 'json', 'query': query}
175
+ # r = requests.get(url, params=dicc)
176
+ # data = r.json()
177
+ # pprint(data['results'])
178
+ # print(data['results']['bindings'])
179
+ # # val = int(data['results']['bindings'][0]['instances']['value'])
180
+ # # self.assertTrue(val > 80)
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: damewebutils
3
- Version: 0.2.3
3
+ Version: 0.2.3.post1
4
4
  Summary: Web utils for Python
5
5
  Home-page: http://github.com/davidam/damewebutils
6
6
  Author: David Arroyo Menéndez
@@ -13,6 +13,23 @@ Classifier: Programming Language :: Python :: 3.6
13
13
  Classifier: Topic :: Text Processing :: Linguistic
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE
16
+ Requires-Dist: SPARQLWrapper
17
+ Requires-Dist: rdflib
18
+ Requires-Dist: markdown
19
+ Requires-Dist: requests
20
+ Requires-Dist: cssselect
21
+ Requires-Dist: lxml
22
+ Dynamic: author
23
+ Dynamic: author-email
24
+ Dynamic: classifier
25
+ Dynamic: description
26
+ Dynamic: description-content-type
27
+ Dynamic: home-page
28
+ Dynamic: keywords
29
+ Dynamic: license
30
+ Dynamic: license-file
31
+ Dynamic: requires-dist
32
+ Dynamic: summary
16
33
 
17
34
  <div id="table-of-contents">
18
35
  <h2>Table of Contents</h2>
@@ -23,21 +23,19 @@ damewebutils/files/output.xhtml
23
23
  damewebutils/files/rss.xml
24
24
  damewebutils/files/source.xml
25
25
  damewebutils/files/tree_created.xml
26
- damewebutils/files//tests/damegender-imgs.txt
27
- damewebutils/files//tests/damegender-rss.txt
28
- damewebutils/files//tests/dameimgs.txt
29
- damewebutils/files//tests/data3.txt
30
- damewebutils/files//tests/davidam-index.txt
31
- damewebutils/files//tests/github-davidam.txt
32
- damewebutils/files//tests/template.txt
33
26
  damewebutils/files/tests/damegender-imgs.txt
34
27
  damewebutils/files/tests/damegender-rss.txt
35
- damewebutils/files/tests/dameimgs.txt
36
28
  damewebutils/files/tests/data3.txt
29
+ damewebutils/files/tests/davidam-index-2026-04-13-14.txt
30
+ damewebutils/files/tests/davidam-index-2026-04-17-14.txt
37
31
  damewebutils/files/tests/davidam-index.txt
38
32
  damewebutils/files/tests/github-davidam.txt
39
33
  damewebutils/files/tests/template.txt
40
34
  damewebutils/tests/test_cookies.py
41
35
  damewebutils/tests/test_requests.py
42
36
  damewebutils/tests/test_wikidata.py
43
- damewebutils/tests/test_xml.py
37
+ damewebutils/tests/test_xml.py
38
+ damewebutils/tests/__pycache__/test_cookies.cpython-314-pytest-9.0.1.pyc
39
+ damewebutils/tests/__pycache__/test_requests.cpython-314-pytest-9.0.1.pyc
40
+ damewebutils/tests/__pycache__/test_wikidata.cpython-314-pytest-9.0.1.pyc
41
+ damewebutils/tests/__pycache__/test_xml.cpython-314-pytest-9.0.1.pyc
@@ -62,7 +62,7 @@ with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
62
62
  long_description = f.read()
63
63
 
64
64
  setup(name='damewebutils',
65
- version='0.2.3',
65
+ version='0.2.3.post1',
66
66
  description='Web utils for Python',
67
67
  long_description=long_description,
68
68
  long_description_content_type='text/markdown',
@@ -94,8 +94,8 @@ setup(name='damewebutils',
94
94
  ['testsbycommands.sh',
95
95
  'dameimgs.py',
96
96
  'damejson.py',
97
- 'dameserver.py',
98
97
  'damerss.py',
98
+ 'dameserver.py',
99
99
  'dameurls.py',]
100
100
  + files_one_level_drop_pwd(cwd + "/damewebutils/tests/")
101
101
  + files_one_level_drop_pwd(cwd + "/damewebutils/files/")
@@ -20,33 +20,33 @@
20
20
  # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
21
  # Boston, MA 02110-1301 USA,
22
22
 
23
- python3 dameurls.py http://www.davidam.com > damewebutils/files/tests/davidam-index-$(date "+%Y-%m-%d-%H").txt
23
+ # python3 dameurls.py https://www.davidam.com > damewebutils/files/tests/davidam-index-$(date "+%Y-%m-%d-%H").txt
24
24
 
25
- if ! diff damewebutils/files/tests/davidam-index.txt damewebutils/files/tests/davidam-index-$(date "+%Y-%m-%d-%H").txt >/dev/null 2>&1
26
- then
27
- echo "dameurls.py with davidam.com test is failing"
28
- else
29
- echo "dameurls.py with davidam.com test is ok"
30
- fi
25
+ # if ! diff damewebutils/files/tests/davidam-index.txt damewebutils/files/tests/davidam-index-$(date "+%Y-%m-%d-%H").txt >/dev/null 2>&1
26
+ # then
27
+ # echo "dameurls.py with davidam.com test is failing"
28
+ # else
29
+ # echo "dameurls.py with davidam.com test is ok"
30
+ # fi
31
31
 
32
32
 
33
- python3 dameimgs.py http://damegender.davidam.com > damewebutils/files/tests/damegender-imgs-$(date "+%Y-%m-%d-%H").txt
33
+ # python3 dameimgs.py https://damegender.davidam.com > damewebutils/files/tests/damegender-imgs-$(date "+%Y-%m-%d-%H").txt
34
34
 
35
- if ! diff damewebutils/files/tests/damegender-imgs.txt damewebutils/files/tests/damegender-imgs-$(date "+%Y-%m-%d-%H").txt >/dev/null 2>&1
36
- then
37
- echo "dameimgs.py with damegender.davidam.com test is failing"
38
- else
39
- echo "dameimgs.py with damegender.davidam.com test is ok"
40
- fi
35
+ # if ! diff damewebutils/files/tests/damegender-imgs.txt damewebutils/files/tests/damegender-imgs-$(date "+%Y-%m-%d-%H").txt >/dev/null 2>&1
36
+ # then
37
+ # echo "dameimgs.py with damegender.davidam.com test is failing"
38
+ # else
39
+ # echo "dameimgs.py with damegender.davidam.com test is ok"
40
+ # fi
41
41
 
42
- python3 damerss.py http://damegender.davidam.com/rss-feed.xml | head -n 5 > damewebutils/files/tests/damegender-rss-$(date "+%Y-%m-%d-%H").txt
42
+ # python3 damerss.py https://damegender.davidam.com/rss-feed.xml | head -n 5 > damewebutils/files/tests/damegender-rss-$(date "+%Y-%m-%d-%H").txt
43
43
 
44
- if ! diff damewebutils/files/tests/damegender-rss.txt damewebutils/files/tests/damegender-rss-$(date "+%Y-%m-%d-%H").txt >/dev/null 2>&1
45
- then
46
- echo "damerss.py with damegender.davidam.com test is failing"
47
- else
48
- echo "damerss.py with damegender.davidam.com test is ok"
49
- fi
44
+ # if ! diff damewebutils/files/tests/damegender-rss.txt damewebutils/files/tests/damegender-rss-$(date "+%Y-%m-%d-%H").txt >/dev/null 2>&1
45
+ # then
46
+ # echo "damerss.py with https://damegender.davidam.com test is failing"
47
+ # else
48
+ # echo "damerss.py with https://damegender.davidam.com test is ok"
49
+ # fi
50
50
 
51
51
  python3 template.py > damewebutils/files/tests/template-$(date "+%Y-%m-%d-%H").txt
52
52
 
@@ -1,89 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta http-equiv="Content-type" content="text/html; charset=utf-8">
5
- <meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; img-src data:; connect-src 'self'">
6
- <title>Page not found &middot; GitHub Pages</title>
7
- <style type="text/css" media="screen">
8
- body {
9
- background-color: #f1f1f1;
10
- margin: 0;
11
- font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
12
- }
13
-
14
- .container { margin: 50px auto 40px auto; width: 600px; text-align: center; }
15
-
16
- a { color: #4183c4; text-decoration: none; }
17
- a:hover { text-decoration: underline; }
18
-
19
- h1 { width: 800px; position:relative; left: -100px; letter-spacing: -1px; line-height: 60px; font-size: 60px; font-weight: 100; margin: 0px 0 50px 0; text-shadow: 0 1px 0 #fff; }
20
- p { color: rgba(0, 0, 0, 0.5); margin: 20px 0; line-height: 1.6; }
21
-
22
- ul { list-style: none; margin: 25px 0; padding: 0; }
23
- li { display: table-cell; font-weight: bold; width: 1%; }
24
-
25
- .logo { display: inline-block; margin-top: 35px; }
26
- .logo-img-2x { display: none; }
27
- @media
28
- only screen and (-webkit-min-device-pixel-ratio: 2),
29
- only screen and ( min--moz-device-pixel-ratio: 2),
30
- only screen and ( -o-min-device-pixel-ratio: 2/1),
31
- only screen and ( min-device-pixel-ratio: 2),
32
- only screen and ( min-resolution: 192dpi),
33
- only screen and ( min-resolution: 2dppx) {
34
- .logo-img-1x { display: none; }
35
- .logo-img-2x { display: inline-block; }
36
- }
37
-
38
- #suggestions {
39
- margin-top: 35px;
40
- color: #ccc;
41
- }
42
- #suggestions a {
43
- color: #666666;
44
- font-weight: 200;
45
- font-size: 14px;
46
- margin: 0 10px;
47
- }
48
-
49
- </style>
50
- </head>
51
- <body>
52
-
53
- <div class="container">
54
-
55
- <h1>404</h1>
56
- <p><strong>File not found</strong></p>
57
-
58
- <p>
59
- The site configured at this address does not
60
- contain the requested file.
61
- </p>
62
-
63
- <p>
64
- If this is your site, make sure that the filename case matches the URL.<br>
65
- For root URLs (like <code>http://example.com/</code>) you must provide an
66
- <code>index.html</code> file.
67
- </p>
68
-
69
- <p>
70
- <a href="https://help.github.com/pages/">Read the full documentation</a>
71
- for more information about using <strong>GitHub Pages</strong>.
72
- </p>
73
-
74
- <div id="suggestions">
75
- <a href="https://githubstatus.com">GitHub Status</a> &mdash;
76
- <a href="https://twitter.com/githubstatus">@githubstatus</a>
77
- </div>
78
-
79
- <a href="/" class="logo logo-img-1x">
80
- <img width="32" height="32" title="" alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpFMTZCRDY3REIzRjAxMUUyQUQzREIxQzRENUFFNUM5NiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpFMTZCRDY3RUIzRjAxMUUyQUQzREIxQzRENUFFNUM5NiI+IDx4bXBNTTpEZXJpdm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TKGOQW6OH6FBWsyePxdOXLTgxiyebILZCjz+GLgMIKnXNzc49YMlcRdHXcSwxFVgTInQhC9G33UhNoJLuqq6t345p9y3eUy8OTk5PjAHuI9uo4b07FBaOhsu0A4Unc+T1TU1Nj3KsSSE5yJ65jqF2DDd8QqWYmAZrIM2VlZTdnZmb6AbpdV9V6ec9znf5Q7HjYumdRE0JOp3MjitO4SFa+cZz8Umqe3TCbSLvdfkR/kWDdNQl5InuTcysOcpFT35ZrbBxx4p3JAHlZVVW1D/634VRt+FvLBgK/v5LV9WS+10xMTEwtRw7XvqOL+e2Q8V3AYIOIAXQ26/heWVnZCVfcyKHg2CBgTpmPmjYM8l24GyaUHyaIh7XwfR9ErE8qHoDfn2LTNAVC0HX6MFcBIP8Bi+6F6cdW/DICkANRfx99fEYFQ7Nph5i/uQiA214gno7K+guhaiKg9gC62+M8eR7XsBsYJ4ilam60Fb7r7uAj8wFyuwM1oIOWgfmDy6RXEEQzJMPe23DXrVS7rtyD3Df8z/FPgAEAzWU5Ku59ZAUAAAAASUVORK5CYII=">
81
- </a>
82
-
83
- <a href="/" class="logo logo-img-2x">
84
- <img width="32" height="32" title="" alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXg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FqQBfnUZR42PKQFksBr9QKVXCPusD3OiA/RkQ5kP8qV/Jl1WywAp/6+dcmPM2zL1UrUahe4JqfnWWKXIul3uUbfP8njAFLW1OFr3gdFtZ72cNH+PtQT7/brW+NXqJAHh0y9V8/U/A1U7AfwIMAD7mS3pCbuWJAAAAAElFTkSuQmCC">
85
- </a>
86
- </div>
87
- </body>
88
- </html>
89
-
@@ -1,179 +0,0 @@
1
- #!/usr/bin/python
2
- # -*- coding: utf-8 -*-
3
-
4
- # Copyright (C) 2020 David Arroyo Menéndez
5
-
6
- # Author: David Arroyo Menéndez <davidam@gnu.org>
7
- # Maintainer: David Arroyo Menéndez <davidam@gnu.org>
8
-
9
- # This file is free software; you can redistribute it and/or modify
10
- # it under the terms of the GNU General Public License as published by
11
- # the Free Software Foundation; either version 3, or (at your option)
12
- # any later version.
13
-
14
- # This file is distributed in the hope that it will be useful,
15
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- # GNU General Public License for more details.
18
-
19
- # You should have received a copy of the GNU General Public License
20
- # along with damewebutils; see the file LICENSE. If not, write to
21
- # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22
- # Boston, MA 02110-1301 USA,
23
-
24
- from unittest import TestCase
25
- from SPARQLWrapper import SPARQLWrapper, JSON
26
- import requests
27
-
28
-
29
- class TestWikidata(TestCase):
30
-
31
- def test_dbpedia_asturias(self):
32
- sparql = SPARQLWrapper("http://dbpedia.org/sparql")
33
- sparql.setQuery("""
34
- PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
35
- SELECT ?label
36
- WHERE { <http://dbpedia.org/resource/Asturias> rdfs:label ?label }
37
- """)
38
- sparql.setReturnFormat(JSON)
39
- results = sparql.query().convert()
40
-
41
- l1 = []
42
- for result in results["results"]["bindings"]:
43
- l1.append(result["label"]["value"])
44
- self.assertEqual(l1[0], 'Asturias')
45
-
46
- def test_surnames(self):
47
- url = 'https://query.wikidata.org/sparql'
48
- query = """
49
- SELECT ?surname ?surnameLabel ?count
50
- WHERE
51
- {
52
- {
53
- SELECT ?surname (COUNT(?human) AS ?count) WHERE {
54
- # ?human wdt:P31 wd:Q5.
55
- ?human wdt:P734 ?surname.
56
- }
57
- GROUP BY ?surname ORDER BY DESC(?count) LIMIT 2
58
- }
59
- SERVICE wikibase:label
60
- { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
61
- }
62
- ORDER BY DESC(?count)
63
- LIMIT 2
64
- # limit to 10 results so we don't timeout
65
- """
66
- r = requests.get(url, params={'format': 'json', 'query': query})
67
- data = r.json()
68
- l1 = []
69
- for result in data["results"]["bindings"]:
70
- elem = [result['surnameLabel']['value'], result['count']['value']]
71
- l1.append(elem[0])
72
- self.assertEqual(l1, ['Li', 'Wang'])
73
-
74
- def test_openstreetmap(self):
75
- # https://www.wikidata.org/wiki/Wikidata:OpenStreetMap
76
- url = 'https://query.wikidata.org/sparql'
77
- query = """
78
- SELECT ?itemLabel ?item ?OSM ?code
79
- WHERE
80
- {
81
- ?item wdt:P31 wd:Q6465 . #French départements
82
- ?item wdt:P300 ?code . #with ISO 3166-2 code
83
- OPTIONAL { ?item wdt:P402 ?OSM }. #OSM relation if available
84
- SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" }
85
- }
86
- """
87
- dicc1 = {'format': 'json', 'query': query}
88
- r = requests.get(url, params=dicc1)
89
- data = r.json()
90
- l1 = []
91
- vector = data['results']['bindings'][0]
92
- values = [vector['code']['value'],
93
- vector['OSM']['value'],
94
- vector['itemLabel']['value'],
95
- vector['item']['value']]
96
- arr1 = ['FR-44', '7432', 'Loire-Atlantique',
97
- 'http://www.wikidata.org/entity/Q3068']
98
- self.assertEqual(values, arr1)
99
-
100
- def test_conan_doyle(self):
101
- # https://www.wikidata.org/wiki/Wikidata:SPARQL_tutorial#Arthur_Conan_Doyle_books
102
- url = 'https://query.wikidata.org/sparql'
103
- query = """
104
- SELECT ?book ?bookLabel
105
- WHERE
106
- {
107
- ?book wdt:P50 wd:Q35610.
108
- SERVICE wikibase:label
109
- { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
110
- }
111
- ORDER BY DESC(?book)
112
- LIMIT 2
113
- """
114
- dicc = {'format': 'json', 'query': query}
115
- r = requests.get(url, params=dicc)
116
- data = r.json()
117
- # print(data['results']['bindings'][0]['bookLabel'])
118
- arr1 = data['results']['bindings'][0]['bookLabel']
119
- dicc1 = {'type': 'literal', 'value': 'Q45192'}
120
- self.assertEqual(arr1, dicc1)
121
-
122
- def test_ue(self):
123
- # https://towardsdatascience.com/a-brief-introduction-to-wikidata-bb4e66395eb1
124
- url = 'https://query.wikidata.org/sparql'
125
- query = """
126
- SELECT ?country ?countryLabel ?capitalLabel ?population
127
- WHERE
128
- {
129
- ?country wdt:P463 wd:Q458.
130
- ?country wdt:P36 ?capital.
131
- ?capital wdt:P1082 ?population.
132
- SERVICE wikibase:label
133
- { bd:serviceParam wikibase:language " [AUTO_LANGUAGE],en". }
134
- }
135
- ORDER BY DESC(?capital)
136
- """
137
- dicc1 = {'format': 'json', 'query': query}
138
- r = requests.get(url, params=dicc1)
139
- data = r.json()
140
- arr1 = data['results']['bindings'][0]['countryLabel']['value']
141
- val1 = "Kingdom of the Netherlands"
142
- self.assertEqual(arr1, val1)
143
-
144
- def test_cervantes(self):
145
- # http://www.cervantesvirtual.com/obra/la-serrana-de-la-vera--0/
146
- url = 'https://query.wikidata.org/sparql'
147
- query = """
148
- SELECT ?workLabel WHERE {
149
- wd:Q165257 wdt:P2799 ?id
150
- BIND(uri(concat("http://data.cervantesvirtual.com/person/", ?id)) as ?bvmcID)
151
- SERVICE <http://data.cervantesvirtual.com/openrdf-sesame/repositories/data> {
152
- ?bvmcID <http://rdaregistry.info/Elements/a/authorOf> ?work .
153
- ?work rdfs:label ?workLabel
154
- }
155
- }
156
- ORDER BY (?id)
157
- """
158
- dicc = {'format': 'json', 'query': query}
159
- r = requests.get(url, params=dicc)
160
- data = r.json()
161
- arr1 = data['results']['bindings'][0]
162
- dicc2 = {'workLabel': {'type': 'literal',
163
- 'value': 'El príncipe inocente : comedia'}}
164
- self.assertEqual(arr1, dicc2)
165
-
166
- def test_number_of_computer_types(self):
167
- url = 'https://query.wikidata.org/sparql'
168
- query = """
169
- SELECT (count(*) as ?instances) WHERE {
170
- # Instance has a type of home computers
171
- ?instance wdt:P31 wd:Q473708
172
- }
173
- """
174
- dicc = {'format': 'json', 'query': query}
175
- r = requests.get(url, params=dicc)
176
- data = r.json()
177
- print(data['results']['bindings'])
178
- val = int(data['results']['bindings'][0]['instances']['value'])
179
- self.assertTrue(val > 80)
File without changes