diff --git a/API.md b/API.md index 3e2465a8..c6a1cbe3 100644 --- a/API.md +++ b/API.md @@ -169,6 +169,10 @@ Return the api docs formatted with markdown. Download the PlexPy log file. +### download_plex_log +Download the Plex log file. + + ### edit_library Update a library section on PlexPy. @@ -318,6 +322,31 @@ Returns: ``` +### get_geoip_lookup +Get the geolocation info for an IP address. The GeoLite2 database must be installed. + +``` +Required parameters: + ip_address + +Optional parameters: + None + +Returns: + json: + {"country": "United States", + "region": "California", + "city": "Mountain View", + "timezone": "America/Los_Angeles", + "latitude": 37.386, + "longitude": -122.0838 + } + json: + {"error": "The address 127.0.0.1 is not in the database." + } +``` + + ### get_history Get the PlexPy history. @@ -555,16 +584,16 @@ Optional parameters: Returns: json: - {"child_count": null, - "count": 887, - "do_notify": 1, - "do_notify_created": 1, - "keep_history": 1, - "library_art": "/:/resources/movie-fanart.jpg", - "library_thumb": "/:/resources/movie.png", - "parent_count": null, - "section_id": 1, - "section_name": "Movies", + {"child_count": null, + "count": 887, + "do_notify": 1, + "do_notify_created": 1, + "keep_history": 1, + "library_art": "/:/resources/movie-fanart.jpg", + "library_thumb": "/:/resources/movie.png", + "parent_count": null, + "section_id": 1, + "section_name": "Movies", "section_type": "movie" } ``` @@ -1419,7 +1448,7 @@ Returns: "is_home_user": 1, "is_restricted": 0, "keep_history": 1, - "shared_libraries": ["10", "1", "4", "5", "15", "20", "2"], + "shared_libraries": ["10", "1", "4", "5", "15", "20", "2"], "user_id": 133788, "user_thumb": "https://plex.tv/users/k10w42309cynaopq/avatar", "username": "LordCommanderSnow" diff --git a/plexpy/webserve.py b/plexpy/webserve.py index 3c3d3c04..4508bcb3 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -4265,7 +4265,31 @@ class WebInterface(object): @cherrypy.expose @cherrypy.tools.json_out() @requireAuth() + @addtoapi() def get_geoip_lookup(self, ip_address='', **kwargs): + """ Get the geolocation info for an IP address. The GeoLite2 database must be installed. + + ``` + Required parameters: + ip_address + + Optional parameters: + None + + Returns: + json: + {"country": "United States", + "region": "California", + "city": "Mountain View", + "timezone": "America/Los_Angeles", + "latitude": 37.386, + "longitude": -122.0838 + } + json: + {"error": "The address 127.0.0.1 is not in the database." + } + ``` + """ geo_info = helpers.geoip_lookup(ip_address) if isinstance(geo_info, basestring): return {'error': geo_info}