#πŸ”’ Please read: If somebody understands numpy and logging in API with a token to acess json informati

89 messages Β· Page 1 of 1 (latest)

regal ridgeBOT
#

@peak perch

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

quartz sand
#

Please actually ask your question, nobody will know if they can help you without seeing the actual problem

peak perch
#

Hello, i really need to call somebody and share screen it's too complicated for me to even formulate

#

I feel extremely dumb trying to get to the bottom of the matter

#

I can only visually represent what I am struggling with.

quartz sand
#

If you can't write it in text, why do you think you'll be able to put it in spoken words? Both are words. Just write down what you'd say

#

First, start with the error about the token and api

peak perch
#

Okay I apologise, so I need to acess valuable information for my python program, through an API (which is given by the site) . Now I have the AUTHORIZATION_ID + the correct headers. The only problem is that i have wrong parameters which causes the site give me back the ERROR 500

#

I tried for multiple hours playing around the paramaters but still can't manage to fix them myself..

zinc yacht
#

!code

regal ridgeBOT
#
Formatting code on Discord

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

For long code samples, you can use our pastebin.

peak perch
#

!cide

#

!code

regal ridgeBOT
#
Formatting code on Discord

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

For long code samples, you can use our pastebin.

peak perch
#

I messaged you privately friends

#

please respond

zinc yacht
peak perch
#

I Don't have paid nitro and it doesn't allow me to share with you

#

there's some sort of limit

wanton warren
regal ridgeBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

peak perch
#

@zinc yacht @wanton warren @quartz sand

#

The problem is in the parameters I there seems to be an issue

#

Everything else is correct.

#

I want to be able to resolve the issue myself but I have to know how to acess the link through a browser so i can see the parameters myself.

quartz sand
#

I'd say to check the docs and make sure the auth header is correct. Oftentimes that header is not some "id", but actually has a word before it, like "Bearer token_here"

Also, don't add useragent to try mimic a browser - it's an api, it shouldn't care if you access it from code. Less headers is better. Normally you'd only send auth and accept and leave the rest to defaults... Especially since you add ad-tracking headers as well :x

peak perch
#

So @quartz sand your suggestion is removing the parameters

quartz sand
#

Where are the docs for this api?

wanton warren
wanton warren
#

πŸ‘

#

Whats the body of the 500 response?
Is there an error message in there?

peak perch
#

Internal server error.

#

But I am sure everything is working probably I am just giving it the wrong parameters

#

I don't know how to check the parameters 😦

#

here is the entire code with Bearer

quartz sand
#

Never ever post your tokens publicly

peak perch
peak perch
regal ridgeBOT
#

Hey @peak perch!

It looks like you are trying to paste code into this channel.

You seem to be using the wrong symbols to indicate where the code block should start. The correct symbols would be ```, not '''.

Here is an example of how it should look:
```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
You can **edit your original message** to correct your code block.
peak perch
#
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Internal Server Error</pre>
</body>
</html

Process finished with exit code 1

quartz sand
#

Btw, that token doesn't look like bearer token. Bearer for basic auth is encoded with base 64

peak perch
#

Nicky can you please talk with me

quartz sand
#

I'm talking with you now

peak perch
#

no i mean i call you and share my screen

#

sorry if not possible i just ask

quartz sand
#

If you remove the header and encode the bearer properly (e.g. via requests' auth), you will get error 403 instead of server error
But 403 still says the token is wrong

peak perch
#

Okay sorry i don't want to waste your time nicky could you just tell me a good tutorial video on where i can learn

#

a way to fix this issue

quartz sand
#

Without the api docs you probably won't be able to fix it, because you don't even know what you're doing wrong

#

But for api itself: if you know anything about restful, requests' docs are quite nice.

peak perch
#

check this > when it runs it spits out the needed information

#

So that's why I assumed that it needs different parameters , the only thing i don't know is how to access these parameters

quartz sand
#

Open the api docs. Since you have the token, you have to have access to the docs

#

If you don't have access to the docs, it means you shouldn't have tried to mess with the api at all

peak perch
#

wait what ? I am not allowed to use the API ?

#

is this true

quartz sand
#

Where did you get that token?

peak perch
#

1 year ago I paid a person to create the code for me

#

He said that the API is free of use

#

but it gives me an error.

quartz sand
# peak perch wait what ? I am not allowed to use the API ?

Before, @wanton warren said the docs are just not publicly available but since you got the token, we assumed those are available for logged in users and that's how you got the token as well.

The website also doesn't appear to have a ToS

But the fact that api is not public at all, it means it's api is for internal use only.
Api links being visible doesn't mean they're open to public use, the links have to exist for the website itself to function

quartz sand
peak perch
#

I made a mistake - it's for the second link

#

the first one spits out the needed information

quartz sand
#

It's not, because after you posted the token, I copied it and also got 500 for the first link. :x That's why I said it seems to fail with wrong format of the token

peak perch
#

However i need the same code for a different game history, I thought it would work since it's provided by the same site but i suppose the parameters are wrong

quartz sand
#

While for correctly encoded header (with base64) it returns 403 instead, not internal server error

peak perch
#

okay Nicky can i ask you one question please

#

sorry for wasting your time

#

Do you know a good tutorial video on how to check those json texts in site API

#

and using the token through networking in chrome

#

Seriously I don't know what to even type in the search bar to start learning how to fix my issue

quartz sand
#

!rule 5 as I said, the website doesn't have ToS but from all the signs it appears the api wasn't meant to be used by users, so it falls under this rule

regal ridgeBOT
#

5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.

peak perch
#

but the boy who made the code said nothing illegal doing this i asked him wow

#

then he lied to me

regal ridgeBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.

#

πŸ”’ Please read: If somebody understands numpy and logging in API with a token to acess json informati