Menu

1 / 2

Automating location-based SERP checks with Python

DEV Community: webdev·Sebastian Cole·6 months ago
#u1aGtTo3
#dev#city#local#cities#rankings
Reading 0:00
15s threshold

I’ve been working on local SEO reporting for a client with multiple service areas, and manually checking rankings city by city was becoming painfully time-consuming.

To speed things up, I started automating location-based SERP checks with Python so I could compare rankings across multiple cities in one run.

Simplified example:

import requests

cities = ['London', 'Manchester', 'Birmingham']

for city in cities:

params = {

'keyword': 'plumber',

'country': 'GB',

'city': city,

'language': 'en'

}

response = requests.get( 'https://example-api.com/search', params=params )

print(f'{city}: {response.json()}')

Enter fullscreen mode

Exit fullscreen mode

This made it much easier to:

compare visibility between locations

spot weak local markets

monitor ranking inconsistencies

prioritize local SEO improvements

One interesting thing I found was that rankings varied much more between cities than expected.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.