Skip to content

Commit 9e17e8e

Browse files
author
Daniel
committed
little changes and description how works app in Readme
1 parent 026e5d1 commit 9e17e8e

File tree

5 files changed

+25
-12
lines changed

5 files changed

+25
-12
lines changed

README.md

+18-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
*not everything finished yet, but...*
44

5-
In my program user can:
5+
Application where user select own parameters, after that app searches by selected pages on 'https://www.otomoto.pl' and takes special info about cars. Next data going to database (MYSQL) and user can select specific informations, which can alert him on phone sms (textlocal).
6+
7+
*In my program user can:*
68

79
- select car type:
810

@@ -20,11 +22,20 @@ In my program user can:
2022
- select car price
2123
- select car's year searching
2224
- select car mileage
23-
- *not yet*:
24-
<!-- - print car city
25-
- print info about car
26-
- change pages -->
25+
- *not yet*: cars model and generation
26+
27+
28+
29+
*If you want use remeber about:*
30+
* driver.exe path change
31+
* download correct selenium webdriver version
32+
* MYSQL workbench to configure config file
33+
* create account on textlocal and take api key
34+
* fill function (send_SMS) parameters
35+
36+
**LINKS**:
2737

28-
I tried different ways to find data.
38+
- Selenium: https://www.selenium.dev/
39+
- MYSQL: https://dev.mysql.com/
40+
- Textlocal: https://www.textlocal.com/
2941

30-
*If you want use remeber about path change*

myproject/project_files/bot.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from selenium.webdriver.support.ui import WebDriverWait
66
from selenium.webdriver.support import expected_conditions as EC
77
from project_files import value
8-
8+
import time
99

1010

1111

@@ -105,6 +105,7 @@ def search_all(self):
105105
'//*[@data-testid="submit-btn"]'
106106
)
107107
self.implicitly_wait(20)
108+
time.sleep(3)
108109
button.click()
109110

110111

myproject/project_files/functions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def data_send(connect, cursor, sql, data):
5555
cursor.execute( sql, data)
5656
connect.commit()
5757

58-
def sendSMS(apikey, *numbers, author, message):
58+
def send_SMS(apikey, *numbers, author, message):
5959
data = urllib.parse.urlencode({'apikey': apikey, 'numbers': numbers,
6060
'message' : message, 'author': author})
6161
data = data.encode('utf-8')

myproject/run.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from project_files import Cars
22
from project_files import config
3-
from project_files import connection, create_database, create_table, data_send, sendSMS
3+
from project_files import connection, create_database, create_table, data_send, send_SMS
44
from project_files.query import DB_NAME, TABLES, add_new_row, add_specific_row
5-
import os
65

76
car_type = input('Enter car type, for example: Auta małe \n')
87
brand = input('Enter brand \n')
@@ -72,7 +71,7 @@
7271
for data in second_record:
7372
message = 'title: {} \ncity: {} \nprice: {} \nyear: {} \nmileage: {} km2 \nengine: {} cm3 \npetrol: {}'.format(data[1],data[2],data[3],data[4],data[5],data[6],data[7])
7473
print(message)
75-
# sendSMS(apikey='****API_KEY****', numbers='', author='', message=message)
74+
send_SMS(apikey='****API_KEY****', numbers='', author='', message=message)
7675
except:
7776
'Error with sms api'
7877
except:

requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ h11==0.13.0
1111
idna==3.3
1212
itsdangerous==2.1.2
1313
MarkupSafe==2.1.1
14+
mysql-connector-python==8.0.30
1415
outcome==1.2.0
1516
platformdirs==2.5.2
17+
protobuf==3.20.1
1618
pycparser==2.21
1719
PySocks==1.7.1
1820
selenium==4.4.3

0 commit comments

Comments
 (0)