Advertisement
b-7

Python Instagram Username Availability Checker

b-7
Dec 24th, 2022
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. pip install docx requests
  2.  
  3.  
  4.  
  5. import docx
  6. import requests
  7.  
  8. # Open the Word document and read the text
  9. document = docx.Document('document.docx')
  10. username = document.paragraphs[0].text
  11.  
  12. # Append the text to the end of the Instagram URL
  13. url = f'www.instagram.com/{username}'
  14.  
  15. # Send a GET request to the URL and check the response status code
  16. response = requests.get(url)
  17. if response.status_code == 404:
  18. print("Username already taken.")
  19. else:
  20. print("It looks like this username might be available.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement