Can SharePlum list method access lists with an apostrophe in the title? - sharepoint-online

If I run the following lines,
set_list = real_site.list("John Order List")
list_data = set_list.GetListItems()
I get the expected list. But if I run:
set_list = real_site.list("Joe's Order List")
list_data = set_list.GetListItems()
I get this error:
shareplum.errors.ShareplumRequestError: Shareplum HTTP Post Failed : 400 Client Error: Bad Request for url: https://...
I know that "Joe's Order List" definitely exists and when I try it without the apostrophe I get a 500 Server Error: Internal Server Error for url: https://....
Why does an error arise when an apostrophe is included?
Renaming the lists without apostrophes is possible but not ideal. I'd prefer to figure out why this doesn't work and fix the issue. It seems like shareplum is not as mature a package as something like pandas so maybe it's just a kink that has yet to be worked out?
Python 3.10, Windows 10, SharePoint Office 365

Related

requests.get raises IncompleteRead Error with redirecting url

So, i have an url that redirects you. it works with webbrowser.open nicely but requests raises incompleteread error. I'm using python 3.8 on Windows 10
Id='16977332'
D = f'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?dbfrom=pubmed&id={Id}&cmd=prlinks&retmode=ref'
re_dlink = requests.get(D)
run this, and...
raise httplib.IncompleteRead(line)
http.client.IncompleteRead: IncompleteRead(0 bytes read)
UPDATE:
I tried this and it returned 400, bad request. Maybe the URL processed before it gets the target URL.
import http.client
http.client.HTTPConnection._http_vsn = 10
I can get redirected url with selenium but i don't want to use external exe. With that, I decided to choose the long way so i removed retmode=ref from url. Here, you can find info about these urls under the Elink header
You've written the Id in str format. Write that in int like this
Id = 16977332
And it's done.

Unable to get values from a GET request

I am trying to scrape a website to extract values.
I can text back in the response, but cannot see any of the values on the website in the response.
How do i get the values please ?
I have used basic code from stackoverflow as a test to explore the data. The code is posted below. It works on other sites, but not this site ?
import requests
url = 'https://www.ishares.com/uk/individual/en/products/253741/'
data = requests.get(url).text
with open('F:\\webScrapeFolder\\out.txt', 'w') as f:
print(data.encode("utf-8"), file=f)
print('--- end ---')
There is no error message.
The file is written correctly.
However, i do not see any of the numbers ?!?
Check with this
url ="https://www.ishares.com/uk/individual/en/products/253741/?switchLocale=y&siteEntryPassthrough=true"
and try to get the response and still if you cannot get what is expected can you brief more on what is needed

Syntax Error on Get function in requests module

My code throws up syntax error on trying to download data from NYSE site get request functions.
I have changed the format of url string yet the error reappeared.
def get_decade(start=1920, end=1929, extension='prn'):
try:
link = requests.get(f"https://www.nyse.com/publicdocs/nyse/data/Daily_Share_Volume_{start}-{end}.{extension}")
file = os.path.join("..","Data", f"Daily_Share_Volume_{start}-{end}.{extension}")
if link.status_code ==404:
raise
else:
with open(file, "w") as temp_file:
temp_file.write(str(link.content.decode("utf-8")))
print(f"Successfully downloaded {start}-{end}")
except:
print("There was an issue with the download. \n\
You may need a different date range or file extension. \n\
Check out https://www.nyse.com/data/transactions-statistics-data-library")
The error message upon calling the function.
link = requests.get(f"https://www.nyse.com/publicdocs/nyse/data/Daily_Share_Volume_{start}-{end}.{extension}")
^
SyntaxError: invalid syntax
Resolution that will clear the invalid syntax error.
Source
As of Python 3.6, f-strings are a great new way to format strings.
You stated in a comment that
I know how to retrieve the file. I 'm using Python 3.5
In other words, upgrade your Python version or don't use f-strings.

An error occurred saving import/export specification ''

I am new to MS-Access.
The title is the error I get when I try to import an excel sheet into a new table in Access 2016. Note the single empty quote is part of the error message.
I've tried reinstalling, playing around with import options, importing from a CSV, CSV with different encodings, checked the table in excel for errors or inconsistencies.
I have searched and searched without luck. Help would be appreciated.
ADDENDUM:
The CSV I've tried to import is:
CashAccountID,AccountDescription,BankName,BankAccountNumber
301,Primary Checking Account,MegaBank,9017765453
302,Money Market Account,Wells Gargle,3831157490
303,Payroll Account,MegaBank,9835320050
I've encountered the same error and, from trial and error, it appears the issue is related to the size of the Excel file you're importing from. I've had success by splitting the 70MB Excel file into two 35MB files before doing the same import into Excel.
The error message from MS Access is nonsensical - the problem occurs when we're not using an import/export specification at all (and nor are there any saved in the Access I'm running). I think we can put this failure and erroneous error message down as an MS Access bug.

Twitter Error Code 400 when tweeting an emoji

I know that my authentication is working and I can make tweets just fine. I have no reason to believe that the tweepy library is causing this problem, though I suppose I have no reason to rule it out. My code looks something like this, attempting to tweet an emoji flag. No other emoji is working either.
auth = tweepy.OAuthHandler(keys.twitter['consumer_key'], keys.twitter['consumer_secret'])
auth.set_access_token(keys.twitter['access_token'], keys.twitter['access_token_secret'])
api = tweepy.API(auth)
print('Connected to the Twitter API...')
api.update_status(r'testing \U0001F1EB\U0001F1F7')
I get an error code 400 with seemingly no additional info about what the reason is. Trying to determine if the problem is the encoding in the string is somehow wrong, or if it is simply some sort of problem with sending it to Twitter's API.
You have unicode in your string. Because you are using Python 2 use:
api.update_status(u"testing \U0001F1EB\U0001F1F7")
Notice that I changed r"x" to u"x".
If you are using Python 3, you can just use:
api.update_status("testing \U0001F1EB\U0001F1F7")
Update: This is the tweet that I sent using this code:
https://twitter.com/twistedhardware/status/686527722634383360

Resources