I have public API's and I would like to set a quota policy based on the type of consumption.
The user can hit the API with an image or a PDF(multi-page). If it is a PDF, based on the number of pages the quota counter should get updated.
I want to access the PDF object in a Python callout so that I could extract the page count.
Based on the number of pages, I would like to reject a request.
Python Callout Code
import re
request_pdf_file = open(PDF_FILE, 'rb', 1 )
for vLine in request_pdf_file.readlines():
if b"/Count " in vLine:
vPages = int(re.search(b"/Count \d*", vLine).group()[7:] )
return vPages
So my query is : How to access a PDF object from the request in a variable in Apigee
Thanks