Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
FastAPI Cookbook
FastAPI Cookbook

FastAPI Cookbook: Develop high-performance APIs and web applications with Python

eBook
€23.99 €26.99
Paperback
€33.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

FastAPI Cookbook

First Steps with FastAPI

Welcome to the exciting world of FastAPI, a modern, high-performance framework for building APIs and web applications in Python. This first chapter is your gateway to understanding and harnessing the power of FastAPI. Here, you’ll take your initial steps into setting up your development environment, creating your very first FastAPI project, and exploring its fundamental concepts.

FastAPI stands out for its speed, ease of use, and comprehensive documentation, making it a preferred choice for developers looking to build scalable and efficient web applications. In this chapter, you’ll practically engage in setting up FastAPI, learning how to navigate its architecture, and understanding its core components. You’ll gain hands-on experience by defining simple API endpoints, handling HTTP methods, and learning about request and response handling. These foundational skills are crucial for any developer stepping into the world of modern web development with FastAPI.

By the end of this chapter, you will have a solid understanding of FastAPI’s basic structure and capabilities. You’ll be able to set up a new project, define API endpoints, and have a grasp on handling data with FastAPI. This knowledge sets the stage for more advanced topics and complex applications you’ll encounter as you progress through the book.

In this chapter, we’re going to cover the following recipes:

  • Setting up your development environment
  • Creating a new FastAPI project
  • Understanding FastAPI basics
  • Defining your first API endpoint
  • Working with path and query parameters
  • Defining and using request and response models
  • Handling errors and exceptions

Each recipe is designed to provide you with practical knowledge and direct experience, ensuring that by the end of this chapter, you’ll be well equipped to start building your own FastAPI applications.

Technical requirements

To embark on your journey with FastAPI, you’ll need to set up an environment that supports Python development and FastAPI’s functionalities. Here’s a list of the technical requirements and installations needed for this chapter:

  • Python: FastAPI is built on Python, so you’ll need a Python version compatible with your FastAPI version. You can download the latest version of it from python.org.
  • FastAPI: Install FastAPI using pip, Python’s package manager. You can do it by running pip install fastapi from the command terminal.
  • Uvicorn: FastAPI requires an Asynchronous Server Gateway Interface (ASGI) server, and Uvicorn is a lightning-fast ASGI server implementation. Install it using pip install uvicorn.
  • Integrated development environment (IDE): An IDE such as Visual Studio Code (VS Code), PyCharm, or any other IDE that supports Python development will be necessary for writing and testing your code.
  • Postman or Swagger UI: For testing API endpoints. FastAPI automatically generates and hosts Swagger UI, so you can use it right out of the box.
  • Git: Version control is essential, and Git is a widely used system. If not already installed, you can get it from git-scm.com.
  • GitHub account: A GitHub account is required to access the code repositories. Sign up at github.com if you haven’t already.

The code used in the chapter is available on GitHub at the following address: https://github.com/PacktPublishing/FastAPI-Cookbook/tree/main/Chapter01. You can clone or download the repository at https://github.com/PacktPublishing/FastAPI-Cookbook to follow along on your local machine.

Setting up your development environment

This recipe, dedicated to setting up your development environment, is a critical foundation for any successful project in web development. Here, you’ll learn how to install and configure all the essential tools needed to start building with FastAPI.

We begin by guiding you through the installation of Python, the core language behind FastAPI. Next, we’ll move on to installing FastAPI itself, along with Uvicorn, a lightning-fast ASGI server, which serves as the bedrock for running your FastAPI applications.

Setting up an IDE is our next stop. Whether you prefer VS Code, PyCharm, or any other Python-friendly IDE, we’ll provide tips to make your development process smoother and more efficient.

Lastly, we’ll introduce you to Git and GitHub – indispensable tools for version control and collaboration in modern software development. Understanding how to use these tools will not only help you manage your code effectively but also open doors to the vast world of community-driven development and resources.

Getting ready

FastAPI works with Python, so you need to check your Python version before using it. This is an important step for setting up FastAPI. We will guide you through how to install it.

Windows installation

If you work on Windows, follow these steps to install Python:

  1. Visit the official Python website: python.org.
  2. Download the latest version of Python or any other version higher than 3.9.
  3. Run the installer. Ensure to check the box that says Add Python to PATH before clicking Install Now.
  4. After the installation, open Command Prompt and type python --version to confirm the installation.

macOS/Linux installation

macOS usually comes with Python pre-installed; however, it might not be the latest version.

You can use Homebrew (a package manager for macOS). To install it, open the terminal and run it:

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/\Homebrew/install/HEAD/install.sh)"

Then, you can install Python – still from the terminal – with the following command:

$ brew install python

On Linux, you can install Python using the package manager by running the following command:

$ sudo apt-get install python3

That’s all you need to install Python on macOS and Linux systems.

Checking the installation

You can then check that Python is correctly installed by running the following command in the terminal:

$ python --version

If you installed it on Linux, the binary command is python3, so you can check that Python is correctly installed by running the following command:

$ python3 --version

Once Python is installed, we want to make sure that the Python’s package manager is correctly installed. It comes with Python’s installation, and it’s called pip.

From a terminal window, run the following command:

$ pip --version

On Linux, run the following command:

$ pip3 --version

Once Python is installed on your computer, you can now consider installing FastAPI.

How to do it...

When you have Python and pip ready, we can continue with installing FastAPI, the IDE. Then, we will configure Git.

We will do it by following these steps:

  1. Installing FastAPI and Uvicorn
  2. Setting up your IDE (VS Code or PyCharm)
  3. Setting up Git and GitHub to track your project

Installing FastAPI and Uvicorn

With Python set up, the next step is installing FastAPI and Uvicorn. FastAPI is the framework we’ll use to build our applications, and Uvicorn is an ASGI server that runs and serves our FastAPI applications.

Open your command-line interface and install FastAPI and Uvicorn together by running the following command:

$ pip install fastapi[all]

This command installs FastAPI along with its recommended dependencies, including Uvicorn.

To verify the installation, you can simply run uvicorn --version from the terminal.

Setting up your IDE

Choosing the right IDE is a crucial step in your FastAPI journey. An IDE is more than just a text editor; it’s a space where you write, debug, and test your code.

A good IDE can significantly enhance your coding experience and productivity. For FastAPI development and Python in general, two popular choices are VS Code and PyCharm.

VS Code

VS Code is a free, open source, lightweight IDE with powerful features. It offers excellent Python support and is highly customizable.

You can download and install VS Code from the official website (code.visualstudio.com). The installation is quite straightforward. Once installed, open VS Code, go to Extensions (a square icon on the left bar), and search for python. Install the Microsoft version, and that is it.

PyCharm

PyCharm, created by JetBrains, is specifically tailored for Python development. It offers a broad range of tools for professional developers, including excellent support for web development frameworks such as FastAPI.

You can choose between a Community free edition and a Professional paid version. For the scope of the book, the Community Edition is largely sufficient, and it can be downloaded on the JetBrains website: https://www.jetbrains.com/pycharm/download/.

For PyCharm as well, the installation is straightforward.

Enhancing your development experience

For both IDEs – and if you use another of your choice – make sure to leverage basic perks to improve your experience as a developer and be more efficient. Here is a short checklist that I use when I approach a new IDE environment:

  • Code completion and analysis: Good IDEs provide intelligent code completion, error highlighting, and fixes, which are invaluable for efficient development
  • Debugging tools: Utilize debugging features provided by the IDE to diagnose and resolve issues in your code
  • Version control integration: A good IDE offers support for Git, simplifying code change tracking and repository management
  • Customization: Customize your IDE by adjusting themes, key binding, and settings to match your workflow, making your development experience as comfortable and productive as possible

Setting up Git and GitHub

Version control is an essential aspect of software development. Git, coupled with GitHub, forms a powerful toolset for tracking changes, collaborating, and maintaining the history of your projects. You can download the Git installer from the official website git-scm.com and install it.

After installation, configure Git with your username and email using the following commands in the command line:

$ git config --global user.name "Your Name"
$ git config --global user.email "your.email@example.com"

GitHub is the platform chosen to store code examples used in the book. Sign up for a GitHub account at github.com if you don’t already have one.

Creating a new FastAPI project

Setting up a well-organized project structure is crucial for maintaining a clean code base, especially as your application grows and evolves. This recipe will guide you on how to create your first basic FastAPI project. A structured project simplifies navigation, debugging, and collaboration. For FastAPI, following best practices in structuring can significantly enhance scalability and maintainability.

Getting ready

All you need to do to follow the recipe is make sure that you have your development environment set up.

How to do it...

We begin by making a project folder named fastapi_start that we’ll use as the root project folder.

  1. From the terminal at the root project folder level, we’ll set up our virtual environment by running the following command:
    $ python -m venv .venv

    This will create a .venv folder that will contain all packages required for the project within our project's root folder.

  2. Now, you need to activate the environment. If you are on Mac or Linux, run the following command:
    $ source .venv/bin/activate

    From Windows, run the following command:

    $ .venv\Scripts\activate

    When the environment is active, you should see in your terminal a prefix string such as (.venv) $. Alternatively, if you check the location of the python binary command, it should be located within the .venv folder. From now on, each time you install a module with pip, it will be installed in the .venv folder, and it will be activated only if the environment is active.

  3. Now, you can install the fastapi package with uvicorn in your environment by running the following command:
    $ pip install fastapi uvicorn

    Once FastAPI is installed in your environment, open your project folder with your favorite IDE and create a file called main.py.

  4. This file is where your FastAPI application begins. Start by writing the import of the FastAPI module. Then, create an instance of the FastAPI class:
    from fastapi import FastAPI
    app = FastAPI()

    This instance houses the code of your application.

  5. Next, define your first route. Routes in FastAPI are like signposts that direct requests to the appropriate function. Start with a simple route that returns a greeting to the world:
    @app.get("/")
    def read_root():
        return {"Hello": "World"}

    You’ve just created the code for your first FastAPI application.

If you want to track the project, you can set up Git as follows:

  1. In your project’s root directory, open a terminal or Command Prompt and run the following command:
    $ git init

    This simple command prepares your project for version control under Git.

    Before committing, create a .gitignore file to specify untracked files to ignore (such as __pychache__, .venv, or IDE-specific folders). You can also have a look at the one on the GitHub repository of the project at the link: https://github.com/PacktPublishing/FastAPI-Cookbook/blob/main/.gitignore.

  2. Then, add your files with the following command:
    $ git add .
  3. Then, commit them using the following command:
    $ git commit -m "Initial commit"

And that's it. You are now tracking your project with Git.

There’s more...

A well-structured project is not just about neatness; it’s about creating a sustainable and scalable environment where your application can grow and evolve. In FastAPI, this means organizing your project in a way that separates different aspects of your application logically and efficiently.

There is no unique and perfect structure for a FastAPI project; however, a common approach is to divide your project into several key directories:

  • /src: This is where your primary application code lives. Inside /src, you might have subdirectories for different modules of your application. For instance, you could have a models directory for your database models, a routes directory for your FastAPI routes, and a services directory for business logic.
  • /tests: Keeping your tests separate from your application code is a good practice. It makes it easier to manage them and ensures that your production builds don’t include test code.
  • /docs: Documentation is crucial for any project. Whether it’s API documentation, installation guides, or usage instructions, having a dedicated directory for documentation helps maintain clarity.

See also

You can find detailed information on how to manage virtual environments with venv at the following link:

To brush up your knowledge with Git and get familiar with adding, staging and commiting operations, have a look at this guide:

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Explore FastAPI in depth, from basic setup to advanced features such as custom middleware and WebSockets
  • Discover practical strategies to optimize app performance and handle high traffic
  • Implement SQL and NoSQL integration techniques for versatile data management in FastAPI applications
  • Purchase of the print or Kindle book includes a free PDF eBook

Description

FastAPI is a cutting-edge Python framework that is revolutionizing the way web apps and APIs are built. Known for its speed, simplicity, and scalability, FastAPI empowers developers to create high-performing applications with ease. This book will help you leverage FastAPI’s immense potential to handle high-traffic scenarios and integrate seamlessly with modern Python tools. The book begins by familiarizing you with the basics of setting up and configuring your FastAPI environment before moving to the intricacies of building RESTful APIs, managing data with SQL and NoSQL databases, and handling authentication and authorization. Next, you'll focus on advanced topics such as custom middleware, WebSocket communication, and integration with various Python libraries. Each chapter is meticulously crafted with practical recipes, progressing from foundational concepts to advanced features and best practices. The concluding chapters show you how to optimize performance, implement rate limiting, and execute background tasks, empowering you to become a proficient FastAPI developer. By the end of this book, you'll have gained the skills you need to migrate existing apps to FastAPI, and be equipped to tackle any challenge in the modern web development landscape, ensuring your apps are not only functional, but also efficient, secure, and scalable.

Who is this book for?

This book is for Python developers looking to enhance their skills to build scalable, high-performance web apps using FastAPI. Professionals seeking practical guidance to create APIs and web apps that can handle significant traffic and scale as needed will also find this book helpful by learning from both foundational insights and advanced techniques. The book is also designed for anyone familiar with RESTful APIs, HTTP protocols, and database systems, as well as developers looking to migrate existing applications to FastAPI or explore its advanced features.

What you will learn

  • Explore advanced FastAPI functionalities such as dependency injection, custom middleware, and WebSockets
  • Discover various types of data storage for powerful app functionality with SQL and NoSQL
  • Implement testing and debugging practices for clean, robust code
  • Integrate authentication and authorization mechanisms to secure web apps
  • Acquire skills to seamlessly migrate existing applications to FastAPI
  • Write unit and integration tests, ensuring reliability and security for your apps
  • Deploy your FastAPI apps to production environments for real-world use
Estimated delivery fee Deliver to Denmark

Premium delivery 7 - 10 business days

€17.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Aug 02, 2024
Length: 358 pages
Edition : 1st
Language : English
ISBN-13 : 9781805127857
Languages :
Concepts :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Denmark

Premium delivery 7 - 10 business days

€17.95
(Includes tracking information)

Product Details

Publication date : Aug 02, 2024
Length: 358 pages
Edition : 1st
Language : English
ISBN-13 : 9781805127857
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 97.97
Mastering Flask Web and API Development
€29.99
FastAPI Cookbook
€33.99
Python Data Cleaning and Preparation Best Practices
€33.99
Total 97.97 Stars icon

Table of Contents

14 Chapters
Chapter 1: First Steps with FastAPI Chevron down icon Chevron up icon
Chapter 2: Working with Data Chevron down icon Chevron up icon
Chapter 3: Building RESTful APIs with FastAPI Chevron down icon Chevron up icon
Chapter 4: Authentication and Authorization Chevron down icon Chevron up icon
Chapter 5: Testing and Debugging FastAPI Applications Chevron down icon Chevron up icon
Chapter 6: Integrating FastAPI with SQL Databases Chevron down icon Chevron up icon
Chapter 7: Integrating FastAPI with NoSQL Databases Chevron down icon Chevron up icon
Chapter 8: Advanced Features and Best Practices Chevron down icon Chevron up icon
Chapter 9: Working with WebSocket Chevron down icon Chevron up icon
Chapter 10: Integrating FastAPI with other Python Libraries Chevron down icon Chevron up icon
Chapter 11: Middleware and Webhooks Chevron down icon Chevron up icon
Chapter 12: Deploying and Managing FastAPI Applications Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.7
(3 Ratings)
5 star 66.7%
4 star 33.3%
3 star 0%
2 star 0%
1 star 0%
Cliente Amazon Aug 09, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Look no further if you want to learn FastAPI. The book lets you learn exhaustively yet quickly and is very well organized with a lot of use cases. And it covers everything about it, from the first steps, to the most complex scenarios, while also focusing on PyTest integration.I personally keep it with me so that I can go back to the things I need, as the book is also very easy to search.I love how also examples on ML and LLM applications are given!
Amazon Verified review Amazon
M. Aug 17, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
As someone from a JavaScript background who wanted to become more skilled with Python, I find this book an excellent opportunity to learn about FastAPI and use it to create web apps in a different programming language. The author does a great job of making the material easy to understand and giving detailed and practical recipes for success.
Amazon Verified review Amazon
Salman Farsi Sep 02, 2024
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
The FastAPI Cookbook covers everything from setting up your development environment to advanced features like WebSockets and integrating FastAPI with other Python libraries. Each chapter includes hands-on recipes that guide you through real-world scenarios, making it easy to apply what you learn. Emphasizes security, testing, and performance optimization, ensuring you build robust and efficient APIs.Clear explanations and structured content make it accessible for intermediate and advanced Python developers. Highly recommended for FastAPI engineers who want to advance their skills.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the digital copy I get with my Print order? Chevron down icon Chevron up icon

When you buy any Print edition of our Books, you can redeem (for free) the eBook edition of the Print Book you’ve purchased. This gives you instant access to your book when you make an order via PDF, EPUB or our online Reader experience.

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela