-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getting started with high level API for the library #1
Comments
I would like you to determine, based on the MIME-sniffing specification, what data you need as input. So, for example, let’s say that we start with a basic API like: def get_mime(*, body: bytes, content_type_headers: list): -> str
pass This API most likely needs to be extended to be able to support all inputs that affect the MIME-sniffing algorithm. For example, you probably need an additional, boolean parameter for the no-sniff flag (which could eventually be exposed to Scrapy users as a setting). So, what other input data is needed? |
What I read in the MIME-sniffing specification and algorithms, we need these as input:
|
Does the On the other hand, reading 5.1, I see the algorithm changes depending on the origin of the resource: if it’s HTTP, the check-for-apache-bug flag is used, otherwise (file system or some other protocol) it is not. So we probably need an input parameter for this. We could have a protocol parameter, so that the input value is the protocol as seen in the URL (Scrapy supports Regarding the In 7.1, step 1.2, you can read:
I think this means we should allow for a table of additional rows as input, and we should probably raise a |
For starting with API, I am using (Body, Content-Type header, boolean parameter for HTTP, boolean no-sniff flag) as Input and simple mimetype as output. And maybe create another function for determining the resource metadata by following the algorithm mentioned in section 5.1.? |
👍
I expect the main function to internally call other functions, so that the code remains readable. But I would keep those other functions private (prefixed with |
@Gallaecio @elacuesta Please discuss here the basic input-output structure of the API.
Can you please mention the issues you were talking about related to API in the main scrapy repo?
The text was updated successfully, but these errors were encountered: