Api+python to solve the problem of renting

Source: Internet
Author: User
Tags python script

650) this.width=650; "title=" qq20160830120458.jpg "alt=" wkiom1ffbgdgkhmvaae8dxbk9bm378.jpg-wh_50 "src="/HTTP/ S4.51cto.com/wyfs02/m02/86/99/wkiom1ffbgdgkhmvaae8dxbk9bm378.jpg-wh_500x0-wm_3-wmp_4-s_4271369797.jpg "/>


Project Description: Write a Python script to crawl The housing information of a rental site, using the top of the JS API on the map to mark the location of the listing, the distance from the work place within 1 hours to reach the range, attached to the bus path planning function to see the different paths. Project published by EKCIT in the experimental building, complete tutorials and online practice address: Gold Api+python solve the rental problem, you can download the code directly in the tutorial using demo.


First, Introduction


1. Background

The project comes from a rental of the history of Tears (exaggeration): This is the case, the author is going to go to graduate school, and the roommate is graduating in the search for a job, plainly, there is no money, so intend to co-rent. Because of the poor, it is impossible to find a store intermediary, only to see the market, 58, and some rental apps. The period needs to consider two people's commuting range to choose a lot, because of the traffic is not familiar with, only choose their own near the more expensive lot, spend a lot of time to read the market or 58 of personal listings information, but the personal housing information is still flooded with a large number of intermediaries, holding a little hope to make a few calls, The answer is that the price is not rented at all, and then high also can not be rented (most of the listing information does not match). Finally in the dormitory closed one weeks before the rent to a cost-effective also can partition. After all, the partition is still inconvenient, so plan to find a job after the roommate to change a new place, so there is this rental script and curriculum.


I believe there are a lot of fresh graduates may encounter the same situation, I hope this course can really help everyone, perhaps not only in the rent of the house.


Summarize the crux of the problem of renting:

    • No money.

    • Small intermediary release of the price is generally false, will waste you a lot of time.

    • Not familiar with the traffic routes, so that the choice of narrow surface.

    • If you have more than one person, you have to consider commuting time for many people.


Questions to be addressed in this course:

    • Learn the technology, increase knowledge, you can find a good job, find a good job can be rich.

    • This selection of listings from 58 of the brand apartment pavilion, so there is no such a small intermediary, the price is acceptable to me and my roommate. In fact, you can do a classifier filter market on the intermediary to find low-priced personal listings, students need to try.

    • The commute area is circled on the map to solve the problem of unfamiliar traffic routes.

    • This course is a single-player version, but the code just deletes a statement can be used when many people (but the path planning function is only for one person). It is better to open more than one page if it is used directly by many people.


The end result is as follows:

650) this.width=650; "title=" bee646cd6535f9180249a1fd0cf7cb7e_b.jpg "alt=" Wkiom1ffbhcd6hrwaahjejzhetq760.jpg "src= "Http://s3.51cto.com/wyfs02/M01/86/99/wKiom1fFBHCD6hrwAAHJEJzheTQ760.jpg"/>

Because the front-end compatibility is not done, the upper right corner is collapsed. Self-used gadgets actually do not have to look good, efficiency first.


, a large blue color block is the area within an hour's drive from the work place. The blue mark is the listing, and the path plan and the address of the property are automatically given when clicked. The red mark (not "final") is the work place, which was blocked in the these drawings. The input box of the work place has the function of automatic completion, it is also very convenient. As for the listing document, we will create a Python script to crawl the listing information.


2. Knowledge points


During the completion of this course project, we will study:

    1. Simple use of libraries such as requests, BeautifulSoup, CSV, etc.

    2. The use of the German map Javascript API


Second, the experimental environment


Open the terminal, go to the Code directory, create the Rent_proj folder, and use it as our working directory.

$ cd code$ mkdir rent_proj && cd rent_proj


To install the required libraries:

$ sudo apt-get install PYTHON-BS4


Three, the principle of experiment


Three files are used in the experiment: Crawl.py,rent.csv and index.html, where Rent.csv is generated by crawl.py and is a listing file. Crawl.py is a very simple script to crawl Web pages. Index.html is the most important part of displaying the map. The process is implemented in the following general steps:


650) this.width=650; "title=" Untitled.png "alt=" Wkiol1ffbpgsdgmpaapooox0pqm601.png "src=" http://s3.51cto.com/ Wyfs02/m01/86/98/wkiol1ffbpgsdgmpaapooox0pqm601.png "/>


Why don't I put the JS code and CSS code out of the index.html, how to write a script how to get good.


Iv. Demonstration of Effect


Start by choosing a location to work out the commute within an hour:

650) this.width=650; "title=" bee646cd6535f9180249a1fd0cf7cb7e_b.jpg "alt=" Wkiom1ffbskwcqknaahjepmitnc120.jpg "src= "Http://s5.51cto.com/wyfs02/M02/86/99/wKiom1fFBSKwcQKnAAHJEPmItnc120.jpg"/>


Beijing traffic jam is too rampant, may also be Metro insurance:

650) this.width=650; "title=" bee646cd6535f9180249a1fd0cf7cb7e_b.jpg "alt=" Wkiom1ffbtvhrqixaahjeegitse558.jpg "src= "Http://s4.51cto.com/wyfs02/M02/86/99/wKiom1fFBTvhRqIxAAHJEEGITsE558.jpg"/>


After importing the listing file:

650) this.width=650; "title=" bee646cd6535f9180249a1fd0cf7cb7e_b.jpg "alt=" Wkiol1ffbvbg8w-jaahcocnhy6y737.jpg "src= "Http://s2.51cto.com/wyfs02/M01/86/98/wKioL1fFBVbg8w-JAAHcocnhy6Y737.jpg"/>


Choosing a listing will automatically help you plan your route:

650) this.width=650; "title=" bee646cd6535f9180249a1fd0cf7cb7e_b.jpg "alt=" Wkiol1ffbwzj-iyvaahcodth7gk631.jpg "src= "Http://s3.51cto.com/wyfs02/M02/86/98/wKioL1fFBWzj-iYVAAHcodtH7gk631.jpg"/>


Select the location to jump to the target page:

650) this.width=650; "title=" bee646cd6535f9180249a1fd0cf7cb7e_b.jpg "alt=" Wkiom1ffbyrqbj9vaahcoygak3w209.jpg "src= "Http://s1.51cto.com/wyfs02/M00/86/99/wKiom1fFBYrQbJ9VAAHcoYGak3w209.jpg"/>


Wayne Shi
Source: Know
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.


650) this.width=650; "title=" QQ picture 20160830104832.jpg "alt=" wkiom1ffbj7zt-caaae9ckdlzny545.jpg-wh_50 "src="/http S5.51cto.com/wyfs02/m01/86/99/wkiom1ffbj7zt-caaae9ckdlzny545.jpg-wh_500x0-wm_3-wmp_4-s_1549171688.jpg "/>

welcome attention   ---September 11 (Sunday) classes

Click here for details: http://www.51reboot.com/course/devops/

class Format: Instructor-led class/Webcast

QQ Registration: 979950755

This article is from the "Reboot DevOps Development" blog, please be sure to keep this source http://opsdev.blog.51cto.com/2180875/1844243

Api+python to solve the problem of renting

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.