You can try this :
import sys
from qgis.core import (
QgsApplication,
QgsProcessingFeedback,
QgsVectorLayer
)
# See https://gis.stackexchange.com/a/155852/4972 for details about the prefix
QgsApplication.setPrefixPath('/usr', True)
qgs = QgsApplication([], False)
qgs.initQgis()
# Append the path where processing plugin can be found
sys.path.append('/docs/dev/qgis/build/output/python/plugins')
import processing
from processing.core.Processing import Processing
Processing.initialize()
vlayer = QgsVectorLayer('P:/Test/qgis_test/poly_test.shp', "poly_test", "ogr")
parameter_dictionary = {
'INPUT' : vlayer,
'DISTANCE' : 500,
'SEGMENTS' : 25,
'END_CAP_STYLE' : 0,
'JOIN_STYLE' : 1,
'MITER_LIMIT' : 10,
'DISSOLVE' : False,
'OUTPUT' : 'memory:'
}
buffer_result = processing.run("native:buffer", parameter_dictionary)
output = buffer_result['OUTPUT']
Also do not forget to check the QGIS Documentation
References: