docs
  • Getting started
    • Welcome
    • 📥Installation
    • Simple example
  • API reference
    • Index
    • Module "sites"
    • Class "Site"
    • Class "Network"
    • Exceptions
  • Recipes
    • Index
    • Answers
    • Badges
    • Questions
    • Search
    • Site info
    • Users
Powered by GitBook
On this page
  1. Recipes

Search

Searching the questions:

Warning! Either intitle or tagged keyword arguments should be passed, otherwise BadArgumentsError is passed.

from pystackapi import Site
from pystackapi.sites import StackOverflow

site = Site(StackOverflow)

# Search for questions with word "Python" in title
about = site.search(intitle='Python')
q1 = about[0]  # First returned question

# Search for questions with tag [python]
topic = site.search(tagged='Python')
q2 = topic[0]

print(f'{q1}\n')
print(f'{q2}\n')
PreviousQuestionsNextSite info

Last updated 1 year ago