Skip to content

Commit 21f0354

Browse files
author
proxycrawl
committed
Fix python3 import
1 parent 0decae9 commit 21f0354

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,18 @@ Choose a way of installing:
1111

1212
Then import the ProxyCrawlAPI
1313

14+
Python2:
15+
1416
```python
1517
from proxycrawl import ProxyCrawlAPI
1618
```
1719

20+
Python3:
21+
22+
```python
23+
from proxycrawl.proxycrawl_api import ProxyCrawlAPI
24+
```
25+
1826
## Class usage
1927

2028
First initialize the ProxyCrawlAPI class

proxycrawl/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
from proxycrawl_api import ProxyCrawlAPI
1+
try:
2+
# Python 2
3+
from proxycrawl_api import ProxyCrawlAPI
4+
except ModuleNotFoundError:
5+
# Python 3
6+
import proxycrawl.proxycrawl_api

0 commit comments

Comments
 (0)