Search code examples
pythonstackexchange-api

How can I search questions by titles using the StackExchange API?


After seeing the StackExchange API documentation I have tried the following in order to search questions by titles:

from stackapi import StackAPI
import json
SITE = StackAPI('stackoverflow')
SITE.page_size = 30
SITE.max_pages = 1
questions = SITE.fetch('questions')
res = json.dumps(questions)
data = json.loads(res)
print(data)

This just returns a list of questions. Do I need to loop through their titles or is there an easier way?

{'backoff': 0, 'has_more': True, 'page': 1, 'quota_max': 300, 'quota_remaining': 296, 'total': 0, 'items': [{'tags': ['mysql', 'sql', 'subquery'], 'owner': {'reputation': 43, 'user_id': 5385838, 'user_type': 'registered', 'accept_rate': 24, 'profile_image': 'https://www.gravatar.com/avatar/7cc4dccb644455072ca570c50357b58b?s=128&d=identicon&r=PG&f=1', 'display_name': 'curious_learner', 'link': 'https://stackoverflow.com/users/5385838/curious-learner'}, 'is_answered': False, 'view_count': 11, 'answer_count': 1, 'score': 0, 'last_activity_date': 1623746392, 'creation_date': 1623745406, 'question_id': 67982626, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67982626/sub-query-and-common-table-expression', 'title': 'sub query and common
table expression'}, {'tags': ['sql', 'oracle', 'join', 'outer-join'], 'owner': {'reputation': 21, 'user_id': 13559823, 'user_type': 'registered', 'profile_image': 'https://lh5.googleusercontent.com/-O4Z_DhlmuY8/AAAAAAAAAAI/AAAAAAAAAAA/AMZuuclx0hUsZPXWbZdYzWwQGnx93enRHA/photo.jpg?sz=128', 'display_name': 'Debasis Das', 'link': 'https://stackoverflow.com/users/13559823/debasis-das'}, 'is_answered': False, 'view_count': 5, 'answer_count': 0, 'score': 0, 'last_activity_date': 1623746391, 'creation_date': 1623746250, 'last_edit_date': 1623746391, 'question_id': 67982832, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67982832/oracle-sql-left-outer-join-running-long-finally-giving-timeout-error', 'title': 'Oracle SQL Left Outer Join running long finally giving timeout error'}, {'tags': ['kubernetes', 'kubernetes-helm'], 'owner': {'reputation': 1, 'user_id': 12311472, 'user_type': 'registered', 'profile_image': 'https://www.gravatar.com/avatar/2b3e78ad807a13838faccbff0197284b?s=128&d=identicon&r=PG&f=1', 'display_name': 'AllaouaA', 'link': 'https://stackoverflow.com/users/12311472/allaouaa'}, 'is_answered': False, 'view_count': 1, 'answer_count': 0, 'score': 0, 'last_activity_date': 1623746390,
'creation_date': 1623746390, 'question_id': 67982867, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67982867/helm-keyword-template', 'title': 'Helm: keyword "Template"'}, {'tags': ['flutter', 'dart'], 'owner': {'reputation': 292, 'user_id': 2976299, 'user_type': 'registered', 'profile_image': 'https://graph.facebook.com/100000728088754/picture?type=large', 'display_name': 'Florentin Lupascu', 'link': 'https://stackoverflow.com/users/2976299/florentin-lupascu'}, 'is_answered': False, 'view_count': 74, 'answer_count': 1, 'score': 1, 'last_activity_date': 1623746383, 'creation_date': 1606236362, 'last_edit_date': 1606238310, 'question_id': 64991033, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/64991033/how-to-sort-bluetooth-devices-using-rssi-in-flutter', 'title': 'How to sort Bluetooth devices using RSSI in Flutter'}, {'tags': ['python', 'discord', 'discord.py'], 'owner': {'reputation': 319, 'user_id': 12868860, 'user_type': 'registered', 'profile_image': 'https://lh6.googleusercontent.com/-CQJ4QgF2DQY/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3rcexEqPEwD451iZ8xsq0YHXV8w1Bg/photo.jpg?sz=128', 'display_name': 'TTV jokzyz', 'link': 'https://stackoverflow.com/users/12868860/ttv-jokzyz'}, 'is_answered': True, 'view_count': 6356, 'accepted_answer_id': 60246127, 'answer_count': 3, 'score': 1, 'last_activity_date': 1623746380, 'creation_date': 1581829372, 'last_edit_date': 1622874124, 'question_id': 60245575, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/60245575/sending-embeds-through-discord-py', 'title': 'Sending embeds through discord.py'}, {'tags': ['apache-spark', 'amazon-emr'], 'owner': {'reputation': 7, 'user_id': 5438751, 'user_type': 'registered', 'profile_image': 'https://www.gravatar.com/avatar/7a151a50c5eb1314ff4cb814fd14ccfb?s=128&d=identicon&r=PG&f=1', 'display_name': '11lll', 'link': 'https://stackoverflow.com/users/5438751/11lll'}, 'is_answered': False, 'view_count': 15, 'closed_date': 1623746348, 'answer_count': 0, 'score': -1, 'last_activity_date': 1623746363, 'creation_date': 1623743212, 'last_edit_date': 1623746363, 'question_id': 67982093, 'link': 'https://stackoverflow.com/questions/67982093/spark-parameters-and-spark-executor-cores-advice-for-small-clusters-instances', 'closed_reason': 'Opinion-based', 'title': 'Spark parameters and spark.executor.cores advice for small clusters & instances'}, {'tags': ['python', 'sql',
'sqlite'], 'owner': {'reputation': 45, 'user_id': 15089462, 'user_type': 'registered', 'profile_image': 'https://lh4.googleusercontent.com/-HhsbV-hwdb4/AAAAAAAAAAI/AAAAAAAAAAA/AMZuucnib0KD2YtulJbK_S0PzYuJZFQGBw/s96-c/photo.jpg?sz=128', 'display_name': 'Vittawat Laorungroj', 'link': 'https://stackoverflow.com/users/15089462/vittawat-laorungroj'}, 'is_answered': True, 'view_count': 11, 'accepted_answer_id': 67979943, 'answer_count': 1, 'score': 0, 'last_activity_date': 1623746363, 'creation_date': 1623730175, 'last_edit_date': 1623746363, 'question_id': 67979890, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67979890/how-to-set-up-sqlite-to-be-local-server-on-lan', 'title': 'How to set up sqlite to be local server (on lan)'}, {'tags': ['ios', 'swift', 'uitableview', 'tableview'], 'owner': {'reputation': 19, 'user_id': 16066400, 'user_type': 'registered', 'profile_image': 'https://lh3.googleusercontent.com/a/AATXAJwH8y1tF5wzI3W4JjjFTEcZo1m5f1jPlAnZeGgB=k-s128', 'display_name': 'Pinal', 'link': 'https://stackoverflow.com/users/16066400/pinal'}, 'is_answered': False, 'view_count': 47, 'answer_count': 1, 'score': 0, 'last_activity_date': 1623746360, 'creation_date': 1623676771, 'last_edit_date': 1623746360, 'question_id': 67970994, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67970994/how-to-store-selected-tableview-rows-in-an-array', 'title': 'how to store selected tableview rows in an array?'}, {'tags': ['sql', 'shell', 'sed'], 'owner': {'reputation': 1, 'user_id': 16231095, 'user_type': 'registered', 'profile_image': 'https://www.gravatar.com/avatar/a0b96781f292bf6d1eeac42b847b16fc?s=128&d=identicon&r=PG&f=1', 'display_name': 'Darkeue', 'link': 'https://stackoverflow.com/users/16231095/darkeue'}, 'is_answered': False, 'view_count': 3, 'answer_count': 0, 'score': -1, 'last_activity_date': 1623746357, 'creation_date': 1623746357, 'question_id': 67982865, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67982865/sed-replace-multiline-string-between-patterns-in-different-lines', 'title': 'sed - replace multiline string between patterns in different lines'}, {'tags': ['c#', 'validation', '.net-core', 'hotchocolate'], 'owner': {'reputation': 21, 'user_id': 14504735, 'user_type': 'registered', 'profile_image': 'https://www.gravatar.com/avatar/12d58f9074d0085ba59fb7b0bd939d99?s=128&d=identicon&r=PG&f=1', 'display_name': 'Makus', 'link': 'https://stackoverflow.com/users/14504735/makus'}, 'is_answered': True, 'view_count': 358, 'answer_count': 2, 'score': 2, 'last_activity_date': 1623746356, 'creation_date': 1603438026, 'question_id': 64495698, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/64495698/hotchocolate-validation-with-c', 'title': 'Hotchocolate validation with C#'}, {'tags': ['sql', 'mysql-workbench', 'composite-primary-key', 'erd', 'lookup-tables'], 'owner': {'reputation': 1, 'user_id': 15512236, 'user_type': 'registered', 'profile_image': 'https://www.gravatar.com/avatar/1b6fa9ce0c43184428a8db539d4bd6aa?s=128&d=identicon&r=PG&f=1', 'display_name': 'Bryan', 'link': 'https://stackoverflow.com/users/15512236/bryan'}, 'is_answered': False, 'view_count': 2, 'answer_count': 0, 'score': 0, 'last_activity_date': 1623746354, 'creation_date': 1623746354, 'question_id': 67982863, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67982863/trouble-linking-table-that-consist-of-2-same-primary-keys', 'title': 'Trouble linking table that consist of 2 same primary keys'}, {'tags': ['django', 'amazon-s3', 'boto3', 'amazon-cloudfront', 'django-storage'], 'owner': {'reputation': 1, 'user_id': 16226590, 'user_type': 'registered', 'profile_image': 'https://www.gravatar.com/avatar/3e36705294209d76ac2bd839f0a895dd?s=128&d=identicon&r=PG&f=1', 'display_name': 'nassymooo', 'link': 'https://stackoverflow.com/users/16226590/nassymooo'}, 'is_answered': False, 'view_count': 14, 'answer_count': 0, 'score': 0, 'last_activity_date': 1623746353, 'creation_date': 1623711202, 'last_edit_date': 1623746353, 'question_id': 67978047, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67978047/amazon-s3-cloudfront-with-django-access-error-in-serving-static-files-400', 'title': 'Amazon S3 + Cloudfront with Django
- Access error in serving static files (400 - Bad Request authorization mechanism not supported)'}, {'tags': ['h2o', 'predict', 'gam'], 'owner': {'reputation': 167, 'user_id': 8771368, 'user_type': 'registered', 'profile_image': 'https://www.gravatar.com/avatar/f6fe8b76283322e7bab1b4173964cd07?s=128&d=identicon&r=PG&f=1', 'display_name': 'Geir Inge', 'link': 'https://stackoverflow.com/users/8771368/geir-inge'}, 'is_answered': False, 'view_count': 2, 'answer_count': 0, 'score': 0, 'last_activity_date': 1623746353, 'creation_date': 1623746353, 'question_id': 67982862, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67982862/gam-predict-return-each-component-of-the-linear-predictor', 'title': 'GAM predict: Return each component of the linear predictor?'}, {'tags': ['android', 'android-fragments', 'android-navigation'], 'owner': {'reputation': 393, 'user_id': 6372038, 'user_type': 'registered', 'accept_rate': 100, 'profile_image': 'https://i.sstatic.net/aOeNW.png?s=128&g=1', 'display_name': 'Smeagol', 'link': 'https://stackoverflow.com/users/6372038/smeagol'}, 'is_answered': False, 'view_count': 2, 'answer_count': 0, 'score': 0, 'last_activity_date': 1623746351, 'creation_date': 1623746351, 'question_id': 67982861, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67982861/is-there-better-way-to-navigate-in-android-based-on-source-fragment', 'title': 'Is there better way to navigate in Android based on source fragment?'}, {'tags': ['javascript', 'node.js'], 'owner': {'reputation': 575, 'user_id': 15212955, 'user_type': 'registered', 'profile_image': 'https://www.gravatar.com/avatar/25246ba7477630430cb2e58af462e504?s=128&d=identicon&r=PG&f=1', 'display_name': 'Siva Pradhan', 'link': 'https://stackoverflow.com/users/15212955/siva-pradhan'}, 'is_answered': False, 'view_count': 16, 'answer_count': 2, 'score': 0, 'last_activity_date': 1623746351, 'creation_date': 1623744693, 'last_edit_date': 1623746342, 'question_id': 67982457, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67982457/compare-two-array-of-objects-and-filter-element-not-present-in-second-array', 'title': 'Compare two array of objects and filter element not present in second array'}, {'tags': ['javascript', 'remove'], 'owner': {'reputation': 37, 'user_id': 12993662, 'user_type': 'registered', 'profile_image': 'https://www.gravatar.com/avatar/58cebead443f949de398b8227f09576a?s=128&d=identicon&r=PG&f=1', 'display_name': 'Ren Jitsm', 'link': 'https://stackoverflow.com/users/12993662/ren-jitsm'}, 'is_answered': False, 'view_count': 15, 'answer_count': 1, 'score': -1, 'last_activity_date': 1623746350, 'creation_date': 1623745622, 'last_edit_date': 1623745754, 'question_id': 67982679, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67982679/how-can-i-remove-empty-title-tag-using-vanilla-javascript', 'title': 'How can i remove empty title tag using vanilla javascript'}, {'tags': ['vuejs2', 'nuxt.js', 'vuetify.js', 'v-data-table'], 'owner': {'reputation': 1, 'user_id': 16219234, 'user_type': 'registered', 'profile_image': 'https://lh3.googleusercontent.com/a/AATXAJzNXjrhV2ggLdreq5u_IZWRUnh2P7HVacPkWg3M=k-s128', 'display_name': 'Kim dabin', 'link': 'https://stackoverflow.com/users/16219234/kim-dabin'}, 'is_answered': False, 'view_count': 5, 'answer_count': 0, 'score': 0, 'last_activity_date': 1623746344, 'creation_date': 1623744794, 'last_edit_date': 1623746344, 'question_id': 67982484, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67982484/vuetify-table-data-horizontal-representation-duplicated-merge', 'title': 'Vuetify table data horizontal representation duplicated merge'}, {'tags': ['javascript', 'reactjs', 'react-props'], 'owner': {'reputation': 1, 'user_id': 15943986, 'user_type': 'registered', 'profile_image': 'https://lh3.googleusercontent.com/a/AATXAJznNqyK1PIKjyzjScKHDR9AMGWY-Espwsmk11f7pQ=k-s128', 'display_name': 'Rahul Gupta', 'link': 'https://stackoverflow.com/users/15943986/rahul-gupta'}, 'is_answered': False, 'view_count': 17, 'answer_count': 1, 'score': 0, 'last_activity_date': 1623746342, 'creation_date': 1623745834, 'question_id': 67982740, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67982740/react-props-are-updating-even-when-im-not-using-the-props', 'title': 'React props are updating even when i'm not using the props'}, {'tags': ['c++', 'windows', 'multithreading', 'data-race'], 'owner': {'reputation': 22157, 'user_id': 163551, 'user_type': 'registered', 'accept_rate': 93, 'profile_image': 'https://i.sstatic.net/BLZsK.jpg?s=128&g=1', 'display_name': 'Patrick', 'link': 'https://stackoverflow.com/users/163551/patrick'}, 'is_answered': True, 'view_count': 60, 'answer_count': 2, 'score': 3, 'last_activity_date': 1623746336, 'creation_date': 1623663009, 'question_id': 67967849, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67967849/can-changing-a-value-from-x-to-x-in-c-lead-to-a-data-race', 'title': 'Can changing a value from X to X in C++ lead to a data race?'}, {'tags': ['ios', 'swift', 'view', 'hide', 'uitabbar'], 'owner': {'reputation': 7, 'user_id': 14849717, 'user_type': 'registered', 'profile_image': 'https://www.gravatar.com/avatar/82b121d2023d7d502154d58fb6ceb003?s=128&d=identicon&r=PG&f=1', 'display_name': 'Sanchita', 'link': 'https://stackoverflow.com/users/14849717/sanchita'}, 'is_answered': False, 'view_count': 3, 'answer_count': 0, 'score': 0, 'last_activity_date': 1623746334, 'creation_date': 1623746334, 'question_id': 67982857, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67982857/i-am-trying-to-get-a-view-on-top-of-a-uitabbar-where-the-tab-bar-is-hidden-once', 'title': 'I am trying to get a view on top of a UITabBar where the tab bar is hidden once the view appears on it using Swift'}, {'tags': ['c#', 'sql', 'wpf'], 'owner': {'reputation': 1, 'user_id': 15851544, 'user_type': 'registered', 'profile_image': 'https://www.gravatar.com/avatar/4d2986b2e132a763e19347c1be2322e3?s=128&d=identicon&r=PG&f=1', 'display_name': 'atw', 'link': 'https://stackoverflow.com/users/15851544/atw'}, 'is_answered': False, 'view_count': 2, 'answer_count': 0, 'score': 0, 'last_activity_date': 1623746331, 'creation_date': 1623746331, 'question_id': 67982856, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67982856/c-wpf-sql-connection-error-in-one-project-and-not-another', 'title': 'C# WPF SQL connection error in one project and not another'}, {'tags': ['google-material-icons', 'vaadin14'], 'owner': {'reputation': 85, 'user_id': 1384260, 'user_type': 'registered', 'profile_image': 'https://www.gravatar.com/avatar/76db7a5c2344d4dde1a02c41f1a9f19a?s=128&d=identicon&r=PG', 'display_name': 'macnixde', 'link': 'https://stackoverflow.com/users/1384260/macnixde'}, 'is_answered': False, 'view_count': 11, 'answer_count': 1, 'score': 0, 'last_activity_date': 1623746331, 'creation_date': 1623742198, 'question_id': 67981870, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67981870/how-to-use-material-icons-in-vaadin-flow-14-6', 'title': 'How to use Material icons in Vaadin Flow (14.6)'}, {'tags': ['continuous-integration', 'webdriver-io', 'browserstack'], 'owner': {'reputation': 21, 'user_id': 8908824, 'user_type': 'registered', 'profile_image': 'https://www.gravatar.com/avatar/95196e95f08f5eb6de93dbbf942aa018?s=128&d=identicon&r=PG&f=1', 'display_name': 'jessecuster', 'link': 'https://stackoverflow.com/users/8908824/jessecuster'}, 'is_answered': False, 'view_count': 69, 'answer_count': 2, 'score': 1, 'last_activity_date': 1623746329, 'creation_date': 1601473568, 'question_id': 64138940, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/64138940/browserstack-service-webdriverio-automate-session-name-is-changing-during', 'title': 'Browserstack service / webdriverIO / Automate / Session Name is changing
during the test'}, {'tags': ['angular', 'typescript', 'angular-material', 'angular-reactive-forms'], 'owner': {'reputation': 1, 'user_id': 16230654, 'user_type': 'registered', 'profile_image': 'https://www.gravatar.com/avatar/c09156ecd541d31669c9c784391422e9?s=128&d=identicon&r=PG&f=1', 'display_name': 'Herve', 'link': 'https://stackoverflow.com/users/16230654/herve'}, 'is_answered': False, 'view_count': 17, 'answer_count': 1, 'score': 0, 'last_activity_date':
1623746327, 'creation_date': 1623743692, 'question_id': 67982217, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67982217/dialog-angular-form-errors', 'title': 'dialog angular form errors'}, {'tags': ['html', 'css', 'printing', 'media'], 'owner': {'reputation': 315, 'user_id': 1814545, 'user_type': 'registered', 'accept_rate': 74, 'profile_image': 'https://www.gravatar.com/avatar/5b4ff48ee7252804e14fa466f0528cf2?s=128&d=identicon&r=PG', 'display_name': 'raven_977', 'link': 'https://stackoverflow.com/users/1814545/raven-977'}, 'is_answered': False, 'view_count': 4, 'answer_count':
0, 'score': 0, 'last_activity_date': 1623746327, 'creation_date': 1623746327, 'question_id': 67982853, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67982853/how-to-print-an-element-only-on-first-page', 'title': 'How to print an element only on first page'}, {'tags': ['html', 'django'], 'owner': {'reputation': 1, 'user_id': 8250064, 'user_type': 'registered', 'profile_image': 'https://www.gravatar.com/avatar/ee25b7713a648a1a05094fa017833809?s=128&d=identicon&r=PG&f=1', 'display_name': 'eyk107', 'link': 'https://stackoverflow.com/users/8250064/eyk107'}, 'is_answered': False, 'view_count': 2, 'answer_count': 0, 'score': 0, 'last_activity_date': 1623746327, 'creation_date': 1623746327, 'question_id': 67982852, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67982852/django-grouping-form-fields', 'title': 'Django: Grouping form fields'}, {'tags': ['image', 'xamarin.android'], 'owner': {'reputation': 51, 'user_id': 6435315, 'user_type': 'registered', 'accept_rate': 67, 'profile_image': 'https://www.gravatar.com/avatar/d0b2b2fd68d8d16ce501cb61c5ab5ac4?s=128&d=identicon&r=PG&f=1', 'display_name': 'tapastoutvu', 'link': 'https://stackoverflow.com/users/6435315/tapastoutvu'}, 'is_answered': False, 'view_count': 2, 'answer_count': 0, 'score': 0, 'last_activity_date': 1623746324, 'creation_date': 1623746324, 'question_id': 67982851, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67982851/xamarin-android-how-generate-image-with-a-string',
'title': 'xamarin android how generate image with a string'}, {'tags': ['flutter', 'entry-point', 'application-lifecycle'], 'owner': {'reputation': 1499, 'user_id': 3367915, 'user_type': 'registered', 'accept_rate': 73, 'profile_image': 'https://i.sstatic.net/2fjqw.jpg?s=128&g=1', 'display_name': 'Raniys', 'link': 'https://stackoverflow.com/users/3367915/raniys'}, 'is_answered': False, 'view_count': 20, 'bounty_amount': 100, 'bounty_closes_date': 1624351123, 'answer_count': 1, 'score': -1, 'last_activity_date': 1623746323, 'creation_date': 1623392076, 'last_edit_date': 1623741852, 'question_id': 67932059, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67932059/flutter-how-to-shows-privacy-policies-dialog-and-then-to-load-sdks-manually', 'title': 'Flutter - how to shows Privacy Policies dialog and then to load SDKs manually?'}, {'tags': ['python', 'loops', 'class', 'for-loop', 'enums'], 'owner': {'reputation': 83, 'user_id': 10962359, 'user_type': 'registered', 'profile_image': 'https://graph.facebook.com/1547557315388282/picture?type=large', 'display_name': 'Thinh Le', 'link': 'https://stackoverflow.com/users/10962359/thinh-le'}, 'is_answered': False, 'view_count': 5, 'answer_count':
0, 'score': 0, 'last_activity_date': 1623746322, 'creation_date': 1623746322, 'question_id': 67982850, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67982850/how-to-ilterate-within-a-specific-range-of-enum-class-in-python', 'title': 'How to ilterate within a specific range of enum class in Python'}, {'tags': ['python', 'python-3.x', 'selenium', 'firefox'], 'owner': {'reputation': 163, 'user_id': 15290516, 'user_type': 'registered', 'profile_image': 'https://i.sstatic.net/VEPXc.png?s=128&g=1', 'display_name': 'Xeнεi Ξэnвϵς', 'link': 'https://stackoverflow.com/users/15290516/xe%d0%bd%ce%b5i-%ce%9e%d1%8dn%d0%b2%cf%b5%cf%82'}, 'is_answered': False, 'view_count': 15, 'answer_count': 0, 'score': 0, 'last_activity_date': 1623746320, 'creation_date': 1623741277, 'last_edit_date': 1623746320, 'question_id': 67981670, 'content_license': 'CC BY-SA 4.0', 'link': 'https://stackoverflow.com/questions/67981670/python-selenium-get-developer-tools-%e2%86%92network%e2%86%92media-logs', 'title': 'Python selenium get "Developer Tools" →Network→Media logs'}]}

Solution

  • You can use the title parameter of the /search/advanced method:

    title - text which must appear in returned questions' titles.

    The code should look like this:

    from stackapi import StackAPI
    
    search_string = 'How can I search questions by titles using the StackExchange API?'
    
    SITE = StackAPI('stackoverflow')
    questions = SITE.fetch('search/advanced', title = search_string)
    print(questions)
    

    I'd strongly advise you to use Filters so that you only get the parameters you need. See one of my other answers if you're interested.