Closed wristbleed closed 3 years ago
It returns a simple list type, you can print(response)
and see it,
it is [body, contentType, status_code, version, url, contentLength, headers]
you can use to_dict
to get Dict, you can use to_json
to get a JSON.
alright thank you also i tried doing post on something and it kept saying
TypeError: post() missing 1 required positional argument: body
Here my code
def test(): while True: member = open('members.txt') requests.post(f'https://discord.com/api/v8/guilds/$%7BguildID%7D/bans/$%7Bid%7D?', http_headers=http_headers,threads=True) member.close
Also i was wondering if it has proxy support if so how can i use it?
Add body = ""
to where do i add that?
This is the full signature of post, there you can see the types and arguments:
post(
url: string,
body: string,
user_agent: string,
max_redirects: int,
proxy_url: string,
proxy_auth: string,
timeout: int,
http_headers = [("dnt", "1")],
)
Add body = ""
to post( )
arguments.
Im really confused about what u mean by that if u mean like this
r=requests.post(body = "",f"https://discord.com/api/v{randint(6,8)}/guilds/{guild_id}/bans/{member_id}", http_headers=http_headers)
it gives me a 'SyntaxError: positional argument follows keyword argument'
r = requests.post(url = f"https://discord.com/api/v{randint(6,8)}/guilds/{guild_id}/bans/{member_id}", body = "", http_headers=http_headers)
Thats just how Python function arguments work. :shrug:
i was just confused about how u said it but thank u also can u give me an example of how to use proxies on faster than requests because on requests i use proxies={"http": 'http://' + next(rotating)}).result() and it works fine but if i use that on faster than requests it gives me some key errors
proxy_url = "http://proxy.url.here:8080"
Okay thank you sm if i have another question to ask ill let u know thanks for helping me :D
everything works except response it just keeps saying this
if r.response == 200:
return True
else:
return False
AttributeError: 'list' object has no attribute 'response' i tried just printing the response it didnt work either
r
is a list, theres no r.response
, try print( r[2] )
.
it works thank you, for status 429, 201, 404 do i just do r[29] [21] [49] [44] or what
r
is just a list
, r[2]
is just list indexing, item at index 2
of list r
.
im trying to get the status code of the site but it keeps saying this
AttributeError: 'list' object has no attribute 'status_code'
code
if r.status_code == 200: return True