In tutorial ‘A Simple Guide to Python 3 Urllib Post Data to Server’, we know how to post string data to server in python 3. However, how to post binary data, such as image, pdf files to server? In this tutorial, we will show you how to post a binary data to server with an example.
When we are writing an example to illustrate the usage of python base64 library, here is an error: AttributeError: module ‘base64’ has no attribute ‘b64encode’. In this tutorial, we will introduce you how to fix this error.
In this tutorial, we list some web content mime types for web developer, you can refer to this list to help your web application.
Python 3 urlib library can help us to access network, in this tutorial, we will introduce how to send our data to server with http post method. You can learn how to do by following our tutorial.
When we crawl a web page, we send a http request header then will get a http response header. If we crawl successfully, we will get the content of this web page. In this tutorial, we will introduce how to get the string content of web page.
To crawl a web page, we should add some http request headers to our crawler to simulate browser. We can use urllib.request.Request() to build a request object to add some headers to do it. Meanwhile, we also can use urllib.request.build_opener() to create an OpenDirector object to crawl a web page. In this tutorial, we will add some request headers to OpenDirector object to simulate browser.
To get file size in python, we can use os.path.getsize() function, however, this function returns bytes of a file. In this tutorial, we will introduce you how to get a friendly file size.
Copying and moving file are common operations in python, in this tutorial, we will introduce you an easy way to copy and move file with shutil library. shutil allow you copy and move files directly, you do not need open and close file before copying or moving.
PyMuPDF RuntimeError: cycle in page tree will occur when you are iterating pdf page by page. In this tutorial, we will show you how to fix this problem.
To extract text (plain text or html text) from a pdf file is simple in python, we can use PyMuPDF library, which contains many basic pdf operations. In this tutorial, we will introduce you how to extract text from pdf files with it.