Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

sneaker bots

import requests (pip3 install requests or pip install requests)

# GET REQUEST
headers = {
  'user-agent': 'testing'
r = requests.get('https://website.com', headers=headers)
print(r.text)
print(r.status_code)
#send a request to the site you want by changing the website, and if needed add a real user agent so you will not be detected as a bot right away
#r.text is the variable that is storing the information that the website gives when you send the request
#r.status_code stores the status code the website gives.
'''
429 = too many requests
201 or 200 = good request
400 = wrong URL/DATA
403 = banned
'''
  
# POST REQUEST
data = {
  'testfield' : 2
}
r = requests.get('https://website.com', data=data, headers=headers)
print(r.text, r.status_code)
#post data to a website
#r.text is the variable storing the response message
#r.status_code is the status code the website gives 
Comment

PREVIOUS NEXT
Code Example
Python :: python async await 
Python :: Column names reading csv file python 
Python :: python get path of current file 
Python :: create models in django 
Python :: install from github 
Python :: python __version__ 
Python :: pandas drop na in column 
Python :: reverse python dict 
Python :: Issue Pandas TypeError: no numeric data to plot 
Python :: all the positions of a letter occurrences in a string python 
Python :: call a Python range() using range(start, stop, step) 
Python :: python regex cheat sheet 
Python :: how to disable resizing in tkinter 
Python :: sort list of numbers python 
Python :: double for in python 
Python :: python getter decorator 
Python :: how to check if a letter is lowercase in python 
Python :: How to return images in flask response? 
Python :: python obtain data from pandas dataframe without index name 
Python :: no such table: django_session admin 
Python :: python super init 
Python :: plt multiple figures to show 
Python :: pandas groupby percentile 
Python :: django check if queryset is empty 
Python :: python file handling 
Python :: read json file python 
Python :: pip is not a batch command but python is installed 
Python :: python set intersection 
Python :: how to use dictionary comprehension to make a dictionary for some names of a list in python 
Python :: drop column with nan values 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =