damewebutils 0.2.3.post1__tar.gz → 0.2.4__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.
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/PKG-INFO +1 -1
- damewebutils-0.2.4/damewebutils/tests/#test_cookies.py# +82 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/tests/__pycache__/test_cookies.cpython-314-pytest-9.0.1.pyc +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/tests/test_cookies.py +9 -7
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils.egg-info/PKG-INFO +1 -1
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils.egg-info/SOURCES.txt +1 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/setup.py +1 -1
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/LICENSE +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/README.md +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/dameimgs.py +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damejson.py +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damerss.py +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/dameserver.py +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/dameurls.py +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/app/TCPClient.py +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/app/TCPServer.py +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/files/document.xml +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/files/foaf.rdf +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/files/index.xhtml +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/files/items.xml +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/files/output.xhtml +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/files/rss.xml +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/files/source.xml +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/files/tests/damegender-imgs.txt +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/files/tests/damegender-rss.txt +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/files/tests/data3.txt +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/files/tests/davidam-index-2026-04-13-14.txt +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/files/tests/davidam-index-2026-04-17-14.txt +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/files/tests/davidam-index.txt +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/files/tests/github-davidam.txt +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/files/tests/template.txt +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/files/tree_created.xml +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/tests/__pycache__/test_requests.cpython-314-pytest-9.0.1.pyc +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/tests/__pycache__/test_wikidata.cpython-314-pytest-9.0.1.pyc +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/tests/__pycache__/test_xml.cpython-314-pytest-9.0.1.pyc +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/tests/test_requests.py +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/tests/test_wikidata.py +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/tests/test_xml.py +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils.egg-info/dependency_links.txt +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils.egg-info/not-zip-safe +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils.egg-info/requires.txt +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils.egg-info/top_level.txt +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/setup.cfg +0 -0
- {damewebutils-0.2.3.post1 → damewebutils-0.2.4}/testsbycommands.sh +0 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#!/usr/bin/python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
# Copyright (C) 2019 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
|
+
|
|
25
|
+
from unittest import TestCase
|
|
26
|
+
from http import cookies
|
|
27
|
+
import requests
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class TestCookies(TestCase):
|
|
31
|
+
|
|
32
|
+
def test_cookies(self):
|
|
33
|
+
C = cookies.SimpleCookie()
|
|
34
|
+
C["fig"] = "newton"
|
|
35
|
+
C["sugar"] = "water"
|
|
36
|
+
self.assertEqual(str(C["fig"]), "Set-Cookie: fig=newton")
|
|
37
|
+
self.assertEqual(str(C["sugar"]), "Set-Cookie: sugar=water")
|
|
38
|
+
C["rocky"] = "road"
|
|
39
|
+
C["rocky"]["path"] = "/cookie"
|
|
40
|
+
strcookie1 = "Cookie: fig=newton\r\n"
|
|
41
|
+
strcookie1 = strcookie1 + "Cookie: rocky=road; "
|
|
42
|
+
strcookie1 = strcookie1 + "Path=/cookie\r\nCookie: sugar=water"
|
|
43
|
+
self.assertEqual(str(C.output(header="Cookie:")), strcookie1)
|
|
44
|
+
strcookie2 = 'Cookie: fig=newton\r\nCookie: rocky=road\r\n'
|
|
45
|
+
strcookie2 = strcookie2 + 'Cookie: sugar=water'
|
|
46
|
+
self.assertEqual(str(C.output(attrs=[], header="Cookie:")), strcookie2)
|
|
47
|
+
|
|
48
|
+
def test_cookies2(self):
|
|
49
|
+
C = cookies.SimpleCookie()
|
|
50
|
+
# load from a string (HTTP header)
|
|
51
|
+
C.load("chips=ahoy; vienna=finger")
|
|
52
|
+
strcookie = "Set-Cookie: chips=ahoy\r\n"
|
|
53
|
+
strcookie = strcookie + "Set-Cookie: vienna=finger"
|
|
54
|
+
self.assertEqual(str(C), strcookie)
|
|
55
|
+
|
|
56
|
+
def test_cookies3(self):
|
|
57
|
+
C = cookies.SimpleCookie()
|
|
58
|
+
C["oreo"] = "doublestuff"
|
|
59
|
+
C["oreo"]["path"] = "/"
|
|
60
|
+
self.assertEqual(str(C), "Set-Cookie: oreo=doublestuff; Path=/")
|
|
61
|
+
|
|
62
|
+
def test_cookies4(self):
|
|
63
|
+
C = cookies.SimpleCookie()
|
|
64
|
+
C["twix"] = "none for you"
|
|
65
|
+
self.assertEqual(C["twix"].value, "none for you")
|
|
66
|
+
|
|
67
|
+
def test_cookies5(self):
|
|
68
|
+
C = cookies.SimpleCookie()
|
|
69
|
+
# equivalent to C["number"] = str(7)
|
|
70
|
+
C["number"] = 7
|
|
71
|
+
C["string"] = "seven"
|
|
72
|
+
self.assertEqual(C["number"].value, '7')
|
|
73
|
+
self.assertEqual(C["string"].value, "seven")
|
|
74
|
+
|
|
75
|
+
def test_sesssion(self):
|
|
76
|
+
S = requests.Session()
|
|
77
|
+
dict1 = S.cookies.get_dict() # {}
|
|
78
|
+
self.assertEqual(dict1, {})
|
|
79
|
+
response = S.get('http://google.com')
|
|
80
|
+
dict2 = S.cookies.get_dict()
|
|
81
|
+
self.assertTrue(dict2['AEC'] != "")
|
|
82
|
+
|
|
Binary file
|
|
@@ -72,10 +72,12 @@ class TestCookies(TestCase):
|
|
|
72
72
|
self.assertEqual(C["number"].value, '7')
|
|
73
73
|
self.assertEqual(C["string"].value, "seven")
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
75
|
+
def test_sesssion(self):
|
|
76
|
+
S = requests.Session()
|
|
77
|
+
dict1 = S.cookies.get_dict() # {}
|
|
78
|
+
self.assertEqual(dict1, {})
|
|
79
|
+
response = S.get('http://google.com')
|
|
80
|
+
dict2 = S.cookies.get_dict()
|
|
81
|
+
self.assertTrue(dict2['AEC'] != "")
|
|
82
|
+
|
|
83
|
+
|
|
@@ -31,6 +31,7 @@ damewebutils/files/tests/davidam-index-2026-04-17-14.txt
|
|
|
31
31
|
damewebutils/files/tests/davidam-index.txt
|
|
32
32
|
damewebutils/files/tests/github-davidam.txt
|
|
33
33
|
damewebutils/files/tests/template.txt
|
|
34
|
+
damewebutils/tests/#test_cookies.py#
|
|
34
35
|
damewebutils/tests/test_cookies.py
|
|
35
36
|
damewebutils/tests/test_requests.py
|
|
36
37
|
damewebutils/tests/test_wikidata.py
|
|
@@ -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.
|
|
65
|
+
version='0.2.4',
|
|
66
66
|
description='Web utils for Python',
|
|
67
67
|
long_description=long_description,
|
|
68
68
|
long_description_content_type='text/markdown',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{damewebutils-0.2.3.post1 → damewebutils-0.2.4}/damewebutils/files/tests/damegender-imgs.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|