Problem description
decodes the field information encoded by Base64, which is normally decoded in the base64 encoding and decoding tool, but b64decode and A2B in the modules Base64 and binascii under python_ Decoding error in Base64 and other methods
the error information is as follows
---------------------------------------------------------------------------
Error Traceback (most recent call last)
<ipython-input-11-787bc11958b4> in get_proxies(urls)
14 try:
---> 15 raw = base64.b64decode(response)
16 except Exception as r:
c:\program files\python3\lib\base64.py in b64decode(s, altchars, validate)
86 raise binascii.Error('Non-base64 digit found')
---> 87 return binascii.a2b_base64(s)
88
Error: Incorrect padding
Solution
Base64 in Python is read in 4, so the field to be decoded should be a multiple of 4, not enough to add ‘=’
# The field a to be decoded is judged, and if it is a multiple of 4, it is unchanged, and if not, how much is missing, how much is made up
a = a + '=' * (4 - len(a) % 4) if len(a) % 4 != 0 else a
Read More:
- Django Error: binascii.Error: Incorrect padding [How to Solve]
- Zlib.error: error – 3 while decompressing: incorrect header check in Python
- Python Use sqlalchemy Error: pymssql.ProgrammingError: (102, b“Incorrect syntax near ‘(‘.DB-Lib error
- Importerror: DLL load failed: unable to find the specified module in Python
- Python: How to Solve multiprocessing module Error in Windows
- [Solved] Python Networkx Error: Network error: random_state_index is incorrect
- Python Error: ValueError: invalid literal for int() with base 16: ‘ ‘
- [Solved] NPM install Error: check python checking for Python executable python2 in the PATH
- How to Solve no module fcntl Error in Windows
- How to Fix “HTTP error 403: forbidden” in Python 3. X
- [example multitasking] Python multithreading module
- Full explanation of SYS module of Python
- [Solved] error indicates that your module has parameters that were not used in producing loss
- Python PIP Fatal error in launcher: Unable to create process using ‘“e:\program files\programdata
- Python 3 uses the relative path import module
- Error in installing Python 3.6.8 for MacBook pyenv [Solved]
- [Solved] ParserError: NULL byte detected. This byte cannot be processed in Python‘s native csv library
- ModuleNotFoundError: No module named ‘tensorflow.python’ And the pits encountered after installation