gguridi / iab-tcf Goto Github PK
View Code? Open in Web Editor NEWA Python implementation of the IAB consent strings (v1.1 and v2)
License: MIT License
A Python implementation of the IAB consent strings (v1.1 and v2)
License: MIT License
On later stacks iab-tcf cannot be installed due to its dependency on bitarray-hardbyte==1.5.2
I guess most reasonable would be upgrading this dependency - ideally by a not as strict dependency
gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.11 -c bitarray/_bitarray.c -o build/temp.linux-x86_64-cpython-311/bitarray/_bitarray.o
bitarray/_bitarray.c: In function ‘resize’:
bitarray/_bitarray.c:166:23: error: lvalue required as left operand of assignment
166 | Py_SIZE(self) = newsize;
| ^
bitarray/_bitarray.c:174:23: error: lvalue required as left operand of assignment
174 | Py_SIZE(self) = 0;
| ^
bitarray/_bitarray.c:204:19: error: lvalue required as left operand of assignment
204 | Py_SIZE(self) = newsize;
| ^
bitarray/_bitarray.c: In function ‘newbitarrayobject’:
bitarray/_bitarray.c:222:18: error: lvalue required as left operand of assignment
222 | Py_SIZE(obj) = nbytes;
| ^
bitarray/_bitarray.c: In function ‘PyInit__bitarray’:
bitarray/_bitarray.c:3172:28: error: lvalue required as left operand of assignment
3172 | Py_TYPE(&Bitarraytype) = &PyType_Type;
| ^
bitarray/_bitarray.c:3173:31: error: lvalue required as left operand of assignment
3173 | Py_TYPE(&SearchIter_Type) = &PyType_Type;
| ^
bitarray/_bitarray.c:3174:31: error: lvalue required as left operand of assignment
3174 | Py_TYPE(&DecodeIter_Type) = &PyType_Type;
| ^
bitarray/_bitarray.c:3175:33: error: lvalue required as left operand of assignment
3175 | Py_TYPE(&BitarrayIter_Type) = &PyType_Type;
| ^
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]
Can't decode this consent string, even though it's successfully decoded on https://www.consentstringdecoder.com/
from iab_tcf import decode_v2
consent = decode_v2("CPIKj1vPPdzL-ACAnAFRBACsAP_AAH_AAAqIHFNf_X_fb3_j-_59_9t0eY1f9_7_v20zjgeds-8Nyd_X_L8X4mM7vB36pq4KuR4Eu3LBAQdlHOHcTUmw6IkVqTPsbk2Mr7NKJ7PEinMbe2dYGH9_n9XTuZKY79_s_z-v7_f_r-3_3_vp9V---wOJAJMNS-AizEscCSaNKoUQIQriQ6AEAFFCMLRNYQErgp2VwEfoIGACA1ARgRAgxBRiyCAAAAAJKIgJADwQCIAiAQAAgBUgIQAEaAILACQMAgAFANCwAigCECQgyOCo5TAgIkWignkrAEou9jDCEMooAaBAAAAA.YAAAAAAAAAAA")
print(consent.version)
Traceback (most recent call last):
File "test.py", line 3, in
consent = decode_v2("CPIKj1vPPdzL-ACAnAFRBACsAP_AAH_AAAqIHFNf_X_fb3_j-_59_9t0eY1f9_7_v20zjgeds-8Nyd_X_L8X4mM7vB36pq4KuR4Eu3LBAQdlHOHcTUmw6IkVqTPsbk2Mr7NKJ7PEinMbe2dYGH9_n9XTuZKY79_s_z-v7_f_r-3_3_vp9V---wOJAJMNS-AizEscCSaNKoUQIQriQ6AEAFFCMLRNYQErgp2VwEfoIGACA1ARgRAgxBRiyCAAAAAJKIgJADwQCIAiAQAAgBUgIQAEaAILACQMAgAFANCwAigCECQgyOCo5TAgIkWignkrAEou9jDCEMooAaBAAAAA.YAAAAAAAAAAA")
File "/home/hlepouse/.local/lib/python3.6/site-packages/iab_tcf/iab_tcf_v2.py", line 151, in decode_v2
consent = ConsentV2(base64_decode(consent_segments[0]))
File "/home/hlepouse/.local/lib/python3.6/site-packages/iab_tcf/iab_tcf_v2.py", line 35, in init
self.read_interest_vendors()
File "/home/hlepouse/.local/lib/python3.6/site-packages/iab_tcf/iab_tcf_v2.py", line 63, in read_interest_vendors
self.num_interests_entries
File "/home/hlepouse/.local/lib/python3.6/site-packages/iab_tcf/bits.py", line 88, in read_range
start = self.read_int(16)
File "/home/hlepouse/.local/lib/python3.6/site-packages/iab_tcf/bits.py", line 40, in read_int
return ba2int(self.read_bits(n))
File "/home/hlepouse/.local/lib/python3.6/site-packages/bitarray/util.py", line 159, in ba2int
raise ValueError("non-empty bitarray expected")
ValueError: non-empty bitarray expected
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.