While trying to input my API key python is giving me a line too long code
E501: line too long
What I have is
notifications_client = NotificationsAPIClient(aaaaaaa_aaaaaaaa-11aa1a1a-aa11-111a-aaaa-11111aaa1a1a-aa11a1a1-0aa1-11a1-1111-1aa111a0a111)
For obvious reasons I have changed the API key to have only a's 1's and 0's but how can I break up this line of code so I no longer get this error?
E501 is a linter error, not a Python interpreter error. Your code, in theory, should work just fine. If you want to prevent this error, simply break the value up (assuming it's a string ... you don't make that clear):
my_key = ('aaaaaaa_aaaaaaaa-11aa1a1a-aa11-111a-aaaa-'
'11111aaa1a1a-aa11a1a1-0aa1-11a1-1111-'
'1aa111a0a111')
notifications_client = NotificationsAPIClient(my_key)
E501 is not a python error, rather than a PEP8 error. Meaning your line is longer than 80 chars (in your case it's 137 chars long).
Your editor or runtime are verifying that your code is correct by PEP8 rules and that's why you are getting this "error". Your Python code has actually no errors at all.
If you want your code to be PEP8 compliant I suggest:
Here is an example:
API_KEY = 'aaaaaaa_aaaaaaaa-11aa1a1a-aa11-111a' \
'-aaaa-11111aaa1a1a-aa11a1a1-0aa1-' \
'11a1-1111-1aa111a0a111'
notifications_client = NotificationsAPIClient(API_KEY)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With