This topic describes how to search for the required RPM packages by using obshell-sdk-python.
Note
Before you proceed, we recommend that you read the Quick Start topic to learn how to use obshell-sdk-python.
Sample code
Search for the latest RPM package
from obshell import search_package # Search for the latest obshell package of the same architecture and system as the execution machine. def search_same_arch(): pkgs = search_package("obshell") print (pkgs)Search for an RPM package of a specified version
from obshell import search_package # Search for the specified version of the OceanBase Database Community Edition package of the same architecture and system as the execution machine. def search_same_arch_version(): pkgs = search_package("oceanbase-ce", version="4.3.5.0") print (pkgs)
Search for the latest RPM package
from obshell.mirror import BASE_COMMUNITY_MIRROR, EL8, AARCH64 # Search for the latest obshell package of a different architecture. def search_diff_arch(): # Specify the architecture and system as aarch64 and el8. mirror = BASE_COMMUNITY_MIRROR.get_mirror(EL8, AARCH64) pkgs = mirror.search("obshell") print (pkgs)Search for an RPM package of a specified version
from obshell.mirror import BASE_COMMUNITY_MIRROR, EL8, AARCH64 # Search for the specified version of the obshell package of a different architecture. def search_diff_arch_version(): # Specify the architecture and system as aarch64 and el8. mirror = BASE_COMMUNITY_MIRROR.get_mirror(EL8, AARCH64) pkgs = mirror.search("obshell", version="4.2.4.0") print (pkgs)
References
For more information about how to request an API by using obshell-sdk-go, see Search for RPM packages.