docs: use a better import to reflect the new changes

This commit is contained in:
Karim shoair
2025-03-17 06:29:32 +02:00
parent bbc05ca164
commit 18d2d29fa8
2 changed files with 7 additions and 7 deletions
+6 -6
View File
@@ -118,7 +118,7 @@ Deep SerpApi is a dedicated search engine designed for large language models (LL
## Getting Started
```python
from scrapling import Fetcher
from scrapling.fetchers import Fetcher
fetcher = Fetcher(auto_match=False)
@@ -200,7 +200,7 @@ Fetchers are interfaces built on top of other libraries with added features that
### Features
You might be slightly confused by now so let me clear things up. All fetcher-type classes are imported in the same way
```python
from scrapling import Fetcher, StealthyFetcher, PlayWrightFetcher
from scrapling.fetchers import Fetcher, StealthyFetcher, PlayWrightFetcher
```
All of them can take these initialization arguments: `auto_match`, `huge_tree`, `keep_comments`, `keep_cdata`, `storage`, and `storage_args`, which are the same ones you give to the `Adaptor` class.
@@ -232,7 +232,7 @@ You can route all traffic (HTTP and HTTPS) to a proxy for any of these methods i
```
For Async requests, you will just replace the import like below:
```python
>> from scrapling import AsyncFetcher
>> from scrapling.fetchers import AsyncFetcher
>> page = await AsyncFetcher().get('https://httpbin.org/get', stealthy_headers=True, follow_redirects=True)
>> page = await AsyncFetcher().post('https://httpbin.org/post', data={'key': 'value'}, proxy='http://username:password@localhost:8030')
>> page = await AsyncFetcher().put('https://httpbin.org/put', data={'key': 'value'})
@@ -486,7 +486,7 @@ When website owners implement structural changes like
The selector will no longer function and your code needs maintenance. That's where Scrapling's auto-matching feature comes into play.
```python
from scrapling import Adaptor
from scrapling.parser import Adaptor
# Before the change
page = Adaptor(page_source, url='example.com')
element = page.css('#p1' auto_save=True)
@@ -504,7 +504,7 @@ To solve this issue, I will use [The Web Archive](https://archive.org/)'s [Wayba
If I want to extract the Questions button from the old design I can use a selector like this `#hmenus > div:nth-child(1) > ul > li:nth-child(1) > a` This selector is too specific because it was generated by Google Chrome.
Now let's test the same selector in both versions
```python
>> from scrapling import Fetcher
>> from scrapling.fetchers import Fetcher
>> selector = '#hmenus > div:nth-child(1) > ul > li:nth-child(1) > a'
>> old_url = "https://web.archive.org/web/20100102003420/http://stackoverflow.com/"
>> new_url = "https://stackoverflow.com/"
@@ -565,7 +565,7 @@ Note: The filtering process always starts from the first filter it finds in the
Examples to clear any confusion :)
```python
>> from scrapling import Fetcher
>> from scrapling.fetchers import Fetcher
>> page = Fetcher().get('https://quotes.toscrape.com/')
# Find all elements with tag name `div`.
>> page.find_all('div')
+1 -1
View File
@@ -2,7 +2,7 @@
### All current types can be imported alone like below
```python
>>> from scrapling import TextHandler, AttributesHandler
>>> from scrapling.core.custom_types import TextHandler, AttributesHandler
>>> somestring = TextHandler('{}')
>>> somestring.json()