Fsoky

Получение информации о Телефоне | Fsoky

Aug 6th, 2020
650
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.16 KB | None | 0 0
  1. import requests
  2.  
  3. global get_phone
  4. get_phone = input( '[+] Phone : ' )
  5.  
  6. def check():
  7.     pass
  8.  
  9. def info():
  10.     response = requests.get( f'https://htmlweb.ru/geo/api.php?json&telcod={ get_phone }' )
  11.  
  12.     user_country = response.json()[ 'country' ][ 'english' ]
  13.     user_id = response.json()[ 'country' ][ 'id' ]
  14.     user_location = response.json()[ 'country' ][ 'location' ]
  15.     user_city = response.json()[ 'capital' ][ 'english' ]
  16.     user_width = response.json()[ 'capital' ][ 'latitude' ]
  17.     user_lenth = response.json()[ 'capital' ][ 'longitude' ]
  18.     user_post = response.json()[ 'capital' ][ 'post' ]
  19.     user_oper = response.json()[ '0' ][ 'oper' ]
  20.  
  21.     global all_info
  22.     all_info = f'\nCountry : { user_country }\nID : { user_id }\nLocation : { user_location }\nCity : { user_city }\nLatitude : { user_width }\nLongitude : { user_lenth }\nIndex post : { user_post }\nOperator : { user_oper }'
  23.  
  24.     print( all_info )
  25.  
  26. def record():
  27.     user_record = input( '\n[?] Record(y/n) : ' )
  28.  
  29.     if user_record == 'y':
  30.         file = open( 'data_phone.txt', 'a' )
  31.         file.write( f'{ all_info }\n' )
  32.         file.close()
  33.  
  34.     if user_record == 'n':
  35.         print( '\n<O.K>' )
  36.  
  37. def main():
  38.     info()
  39.     record()
  40.  
  41. main()
Add Comment
Please, Sign In to add comment