<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "Handling Pagination in Code"]]></title>
		<link>http://forum.geonames.org/gforum/posts/list/8.page</link>
		<description><![CDATA[Latest messages posted in the topic "Handling Pagination in Code"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>Handling Pagination in Code</title>
				<description><![CDATA[ python
Sao chép mã
import requests

def fetch_children(geoname_id, username, max_rows=10):
    url = "http://api.geonames.org/childrenJSON"
    results = []
    start = 0
    
    while True:
        response = requests.get(url, params={
            'geonameId': geoname_id,
            'username': username,
            'start': start,
            'maxRows': max_rows
        })
        data = response.json()
        children = data.get('geonames', [])
        results.extend(children)
        
        if len(children) < max_rows:
            break
        
        start += max_rows
    
    return results

# Example usage
username = 'YOUR_USERNAME'
geoname_id = '123456'
children = fetch_children(geoname_id, username)
print(children)]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/41033.page#54654</guid>
				<link>http://forum.geonames.org/gforum/posts/list/41033.page#54654</link>
				<pubDate><![CDATA[Wed, 14 Aug 2024 18:41:16]]> GMT</pubDate>
				<author><![CDATA[ philipcraigt]]></author>
			</item>
	</channel>
</rss>