Use the code¶
Getting and parsing user data¶
-
archmap.get_users(url='https://wiki.archlinux.org/index.php/ArchMap/List', local='')[source]¶ This funtion parses the list of users from the ArchWiki and returns it as a string.
Parameters: Returns: The extracted raw-text list of users or None if not avaliable
Return type:
-
archmap.parse_users(users)[source]¶ This function parses the raw-text list (
users) that has been extracted from the wiki page and splits it into a list of namedtuples containing the latitude, longitude, name and comment.Parameters: users (str) -- raw-text list from the ArchWiki Returns: A list of namedtuples, each namedtuple has 4 elements: (latitude, longitude, name, comment)Return type: listofcollections.namedtuple(decimal.Decimal,decimal.Decimal,str,str)
Output generators¶
-
archmap.make_text(parsed_users, output_file='', pretty=False)[source]¶ This function reads the user data supplied by
parsed_users, it then generates a raw-text list according to the formatting specifications on the wiki and writes it tooutput_file.Parameters: - parsed_users (
listofcollections.namedtuple(decimal.Decimal,decimal.Decimal,str,str)) -- A list of namedtuples, each namedtuple should have 4 elements:(latitude, longitude, name, comment) - output_file (str) -- Location to save the text output. If left empty, nothing will be output
- pretty (bool) -- If set to True, the output "columns" will be aligned and expanded to match the longest element
Returns: The text written to the output file
Return type: - parsed_users (
-
archmap.make_geojson(parsed_users, output_file='')[source]¶ This function reads the user data supplied by
parsed_users, it then generates GeoJSON output and writes it tooutput_file.Parameters: - parsed_users (
listofcollections.namedtuple(decimal.Decimal,decimal.Decimal,str,str)) -- A list of namedtuples, each namedtuple should have 4 elements:(latitude, longitude, name, comment) - output_file (str) -- Location to save the GeoJSON output. If left empty, nothing will be output
Returns: The text written to the output file
Return type: - parsed_users (
-
archmap.make_kml(parsed_users, output_file='')[source]¶ This function reads the user data supplied by
parsed_users, it then generates KML output and writes it tooutput_file.Parameters: - parsed_users (
listofcollections.namedtuple(decimal.Decimal,decimal.Decimal,str,str)) -- A list of namedtuples, each namedtuple should have 4 elements:(latitude, longitude, name, comment) - output_file (str) -- Location to save the KML output. If left empty, nothing will be output
Returns: The text written to the output file
Return type: - parsed_users (
-
archmap.make_csv(parsed_users, output_file='')[source]¶ This function reads the user data supplied by
parsed_users, it then generates CSV output and writes it tooutput_file.Parameters: - parsed_users (
listofcollections.namedtuple(decimal.Decimal,decimal.Decimal,str,str)) -- A list of namedtuples, each namedtuple should have 4 elements:(latitude, longitude, name, comment) - output_file (str) -- Location to save the CSV output. If left empty, nothing will be output
Returns: The text written to the output file
Return type: - parsed_users (