# Synchronous Example
import os
from x_api_scraper import XapiScraper
with XapiScraper(
bearer_auth=os.getenv("X_API_SCRAPER_BEARER_AUTH", ""),
) as xapi_scraper:
res = xapi_scraper.search.advanced(search_terms=[
"<value 1>",
"<value 2>",
"<value 3>",
], sort_by="<value>", next_cursor="")
# Handle response
print(res)The same SDK client can also be used to make asynchronous requests by importing asyncio.
# Asynchronous Example
import asyncio
import os
from x_api_scraper import XapiScraper
async def main():
async with XapiScraper(
bearer_auth=os.getenv("X_API_SCRAPER_BEARER_AUTH", ""),
) as xapi_scraper:
res = await xapi_scraper.search.advanced_async(search_terms=[
"<value 1>",
"<value 2>",
"<value 3>",
], sort_by="<value>", next_cursor="")
# Handle response
print(res)
asyncio.run(main())