Skip to content

Commit

Permalink
correction
Browse files Browse the repository at this point in the history
  • Loading branch information
Gas-prod committed Nov 18, 2022
1 parent 3ac8f95 commit d79e3b9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
Binary file modified __pycache__/contact.cpython-38.pyc
Binary file not shown.
4 changes: 1 addition & 3 deletions contact.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import os
import requests
import json
import os

def contact(url, email, msg, name, phone):
id = url.split(".htm")
Expand All @@ -17,7 +15,7 @@ def contact(url, email, msg, name, phone):
payload = {
"email": email,
"listingId": id,
"listingPublicationId": 3006087,
"listingPublicationId": 1,
"message": msg,
"name": name,
"phone": phone
Expand Down
13 changes: 7 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,19 @@ def on_email(self, msgs):
links.append(href)

#recuperer que les liens d'annonces de logement
links = [i for i in links if i.startswith("https://www.seloger.com/annonces/")]
links = [x for x in links if x.startswith("https://www.seloger.com/annonces/")]

#enlever les doublons
tmp_list = [] #liste des liens coupes

for i in links:
cut_link = i.split(".htm")[0] #recuperer que le debut du lien
link = i.split(".htm")[0] #recuperer que le debut du lien

if cut_link not in tmp_list:
tmp_list.append(cut_link)
print(link, "\n")
print(contact(i, email, contact_message, name, phone), "\n")
if link not in tmp_list:
tmp_list.append(link)
print(i, "\n")
#envoyer la requête pour contacter l'agence
print(contact(link, email, contact_message, name, phone).decode("utf-8"), "\n")

# Log into the IMAP server
el.login()
Expand Down

0 comments on commit d79e3b9

Please sign in to comment.