AirBnB-clone is a web application that seeks to replicate the AirBnB software platform for educational purposes.
According to Wikipedia:
Airbnb, Inc., is an American online marketplace and hospitality service brokerage company based in San Francisco, California, United States. Members can use the service to arrange or offer lodging, primarily homestays, or tourism experiences.
AirBnB-clone uses a number of open source projects to work properly:
- Python - Python programming language
AirBnB-clone requires Python version. 3.4.3 to run.
# First clone the repo
$ git clone https://github.com/HeimerR/AirBnB_clone.git
# Second executes the file "console.py" inside the folder AirBnB_clone
$ cd AirBnB_clone && ./console.py
# Start using the console!
You will get a prompt like this:
(hbnb)
You can now start typing console commands to create, update or destroy users, places, etc.
(hbnb) create User
697d2586-e3ca-451a-8221-88ead0eb8283
(hbnb)
The following commands are available to use:
Command | Arguments |
---|---|
create | <class name> |
show | <class name> <id> |
destroy | <class name> <id> |
all | [OPTIONAL <class name>] |
update | <class name> <id> <attribute name> "<attribute value>" |
<class name>.<command>(arguments) |
it depends on the type of command you use |
The following commands are available to use:
Class name | Default Attributes |
---|---|
BaseModel | id, created_at, updated_at |
User | email, password, first_name, last_name |
Place | city_id, user_id, name, description, number_rooms, number_bathrooms |
Place | max_guest, price_by_night, latitude, longitude, amenity_ids |
State | name |
City | state_id, name |
Amenity | name |
Review | place_id, user_id, text |
Let's create a user:
(hbnb) create User
dcc89f74-2663-4f2d-b647-9c829d2b4797
(hbnb)
Now, let's see what it has this instance:
(hbnb) show User dcc89f74-2663-4f2d-b647-9c829d2b4797
[User] (dcc89f74-2663-4f2d-b647-9c829d2b4797) {'updated_at': datetime.datetime(2019, 7, 3, 19, 14, 32, 536201), 'id': 'dcc89f74-2663-4f2d-b647-9c829d2b4797', 'created_at': datetime.datetime(2019, 7, 3, 19, 14, 32, 536180)}
(hbnb)
Let's update an attribute and display all the users:
(hbnb) User.update("dcc89f74-2663-4f2d-b647-9c829d2b4797", "first_name", "Heimer")
(hbnb) User.all()
["[User] (dcc89f74-2663-4f2d-b647-9c829d2b4797) {'created_at': datetime.datetime(2019, 7, 3, 19, 14, 32, 536180), 'id': 'dcc89f74-2663-4f2d-b647-9c829d2b4797', 'first_name': 'Heimer', 'updated_at': datetime.datetime(2019, 7, 3, 19, 18, 4, 845273)}", "[User] (697d2586-e3ca-451a-8221-88ead0eb8283) {'created_at': datetime.datetime(2019, 7, 3, 17, 55, 49, 24311), 'id': '697d2586-e3ca-451a-8221-88ead0eb8283', 'updated_at': datetime.datetime(2019, 7, 3, 18, 1, 19, 126604)}"]
Let's delete the user we created:
(hbnb) destroy User dcc89f74-2663-4f2d-b647-9c829d2b4797
(hbnb) show User dcc89f74-2663-4f2d-b647-9c829d2b4797
** no instance found **
(hbnb)
MIT