Sessions for repeated calls#
Some methods, like
tonita.search(), take as an additional input a
requests.Session object. Using
Sessions can improve performance by reusing the underlying TCP connection to the Tonita API servers and persisting the parameters of that connection. This is especially useful for operations that can take a longer amount of time, like when uploading many listings. See the
requests documentation for more details.
Using Sessions is as easy as passing an instance of it as an additional argument value to applicable functions:
import tonita import requests # Create a session. session = requests.Session() # Add a batch of listings from file. tonita.listings.add( json_path="path/to/data.json", session=session )