"SyntaxError: invalid decimal literal' using Tweepy with an academic access - twitter

Very recently I got an academic access to Twitter API and I would like to start getting some data. Unfortunately, when I run the code I keep getting: "SyntaxError: invalid decimal literal'. It looks that something it is wrong with my bearer token.
In this video https://www.youtube.com/watch?v=rQEsIs9LERM&t=7s, I found the following code:
also here: at n.3 https://github.com/jdfoote/Intro-to-Programming-and-Data-Science/blob/fall2021/extra_topics/twitter_v2_example.ipynb
Unfortunately, every time I try to run the code I got an error that points to the number after the % in my bearer token. One example here:
I tried to regenerate the bearer token multiple times by with no avail. Also, the definition of invalid decimal literal that I found on the internet doesn't seem to help. Any thoughts? Thanks in advance for your time!
Ps. sorry for including the image but the website kept rejecting the indentation of the code.

the solution was banal: it works just adding the quotation marks to the bear token.

Related

Invalid billing_info when upgrading Recurly Gem

Going from version 2.9.3 -> 2.18.0 for the ruby gem.
Have been using v4 for Recurly.js so that stays the same.
This has been working for years and I decided to upgrade the gem.
I am generating the front end token with:
recurly.configure({ publicKey: RECURLY_JS_PUBLIC_KEY })
It generates a token and pass it along to the backend where we do:
Recurly::Account.create!(
account_code: account_code,
billing_info: { token_id: params['recurly-token'] }
)
It keeps raising this error:
Recurly::Resource::Invalid (billing_info is invalid)
I've been messing around with this a lot. Putting in a random string as the token or waiting 20 minutes for the token to expire will throw a different error message:
Recurly::Resource::Invalid: Token (billing_info.token_id) is either invalid or expired
So I feel like it is reading my token correctly and the keys are correct. Could it be that maybe the billing info that I used to generate the token be bad? I've filled out so many different combinations of correct addresses and test credit card numbers.
I'm out of ideas and any help would be nice.
It does sound like the actual billing information might be bad. Are you using the correct test card number (4111-1111-1111-1111) with an expiration date in the future, and all the address information required by your site settings?
Figured out the issue.
There was a problem with the country input. Originally the ISO alpha-2 code worked for the country. But once I updated the gem, the ISO alpha-2 code no longer worked. The front end validation would work and it would create a token fine but the backend would not accept that token.
So using US did not work anymore but United States worked.
I ended up building a dropdown from this list: https://docs.recurly.com/docs/countries-provinces-and-states

Troubleshooting "(400) Bad Request" return from Slack API

We've been using slack API for some time, calling it from powershell inside Jenkins, and all was working fine. The messages have formatting and use some links.
Recently, some messages stopped to get through, returning (400) Bad Request.
If I get the content that failed from logs, and send it manually, the message gets through.
I'm trying to find a way to better troubleshoot what can be wrong with the content or the request, since "Bad Request" is a bit too vague.
In this specific case, I had to remove bit by bit until I found out there was an issue with accentuation and encoding, coming from a text from a git output.
For future reference, removing the encoding from the message might be a way to troubleshoot this kind of issue, as a way to identify if encoding is what's causing the error.
The way I did it in powershell was:
$msg = [Text.Encoding]::UTF8.GetString([Text.Encoding]::GetEncoding("ISO-8859-8").GetBytes($msg))
This generates problems with accentuation, but we're only trying to find if encoding is the issue generating the Bad Request response.
Following Renato's logic, a way of dealing with this in Python is as follows:
"".join(i for i in text if ord(i)<126 and ord(i)>31)
This will remove all non-ASCII characters and line breaks.

Vidyo SDK unexpected disconnection

I downloaded the Vidyo SDK for iOS. I followed the all the steps to generate a new token and succeeded on that. But at the time of joining the call it always prompting Unexpected disconnection. Even in the VidyoConnector Mac app also getting same error. Led to conference inability.
What are all the possibilities of hitting this error. Any help much appreciated!
Based on your description, it seems like the token you have generated is invalid. How did you generate it ? Here is a link that provides with token generation scripts samples in multiple languages.
https://support.vidyo.io/hc/en-us/articles/115003127747-Generate-a-Token
Another tip to validate your token - it's a long string that ends with "==" symbol.
Are you using the python script shared at https://static.vidyo.io/4.1.16.8/utils/generateToken.py
The syntax for using our pyton token generation:- python3 generateToken.py --key= --appID= --userName= --expiresInSecs=10000
Make sure that you do not include any special character like # in the user name

Content encoding error when using linkedin.com/uas/oauth2/authorization

I'm developer working on integration between our product and LinkedIn. It's been decided we use https://www.linkedin.com/uas/oauth2/authorization to authenticate user. I found out the following issue, that I'll explain in detail below.
Positive scenario, everything works as expected:
when using valid client_id, everything is fine. To make everything clear, please see this URL (API key replaced with fake one):
https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=VALID_API_KEY&state=b4ac5e2ab5404d6fad2f25521d83e825&redirect_uri=http%3A%2F%2Flocalhost%3A8085%2Fapply-app%2Fpages%2Fsocial-networks%2Flinkedin%2Fauthenticated%3FsiteIdentifier%3DPIUFK026203F3VBLZ6G79V7OU%26token%3Db4ac5e2ab5404d6fad2f25521d83e825
When I remove client_id, everything is also fine and message is displayed (Missing client_id. A valid client_id is required to proceed.)
But when I use invalid client_id in browser I receive Content Encoding Error and http status code 500. URL: https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=invalid_client_id&state=b4ac5e2ab5404d6fad2f25521d83e825&redirect_uri=http%3A%2F%2Flocalhost%3A8085%2Fapply-app%2Fpages%2Fsocial-networks%2Flinkedin%2Fauthenticated%3FsiteIdentifier%3DPIUFK026203F3VBLZ6G79V7OU%26token%3Db4ac5e2ab5404d6fad2f25521d83e825
And the most interesting part goes here: when I fetch same URL using either wget or even java HttpConnection.connect() there result is different: HTTP status code 200 and html response. But when I started to analyze given output, I noticed that is ends up unexpectedly after <ul class="permissions, so it must me error in your code, that requires fixing.
I reported that, because it's quite inconvenient to support such behavior. Could you please inform me if you have any plans to fix this? If you need any further details regarding steps to reproduce this issue, please do not hesitate to contact me.
Best regards,
Piotr

OAuth in Jira - 'consumer_key_unknown' while requesting token

I am trying to connect to Jira using OAuth. I have followed this manual and I have created app link in Jira instance and configured it with proper consumer key and public key. When I try to request a token using code from the example I am getting 401 with following message (same for python and perl instance):
oauth_problem=consumer_key_unknown
I am out of ideas what can be wrong. I will appreciate any tips.
Well, I believe that I have configured Application link in the wrong place. I have been somehow navigated to the link wiki/admin/listapplicationlinks.action. Then I accidentally found plugins/servlet/applinks/listApplicationLinks which looked pretty much the same as first but content was different. I have added link to the second location and everything works well now. Sorry for confusion.
I also had this similar error. So I then used different "consumer key"(tried to make this unique) other than the given one in the example manual. After searching a lot in internet about this error, I got to know that as most people are using that same consumer key(given in example manual), a database error occurred due to which this error was thrown.

Resources