Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import_data not working due to missing scheme #1658

Closed
CMPeng opened this issue Sep 14, 2023 · 2 comments
Closed

import_data not working due to missing scheme #1658

CMPeng opened this issue Sep 14, 2023 · 2 comments
Assignees
Labels

Comments

@CMPeng
Copy link
Contributor

CMPeng commented Sep 14, 2023

Running notebook https://developers.arcgis.com/python/samples/html-table-to-pandas-data-frame-to-portal-item/ and at cell,

gis.content.import_data(df, {"CountryCode":"Country or subnational area"})

threw error message, indicating either the analyze rest endpoint might not be correct, or the request package is now requesting for a scheme parameter that is not there before; checked all versions of enterprise and agol, all reproducible -

---------------------------------------------------------------------------
MissingSchema                             Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_2600\1075300039.py in <cell line: 0>()
----> 1 fc = agol_gis.content.import_data(df, {"CountryCode":"Country or subnational area"})

~\Anaconda3\envs\arcgis_220_py311\Lib\site-packages\arcgis\gis\__init__.py in import_data(self, df, address_fields, folder, item_id, **kwargs)
   8346         else:
   8347             # Feature Collection Workflow
-> 8348             return _cm_helper.import_as_fc(self._gis, df, **kwargs)
   8349 
   8350     # ----------------------------------------------------------------------

~\Anaconda3\envs\arcgis_220_py311\Lib\site-packages\arcgis\gis\_impl\_content_manager\_import_data.py in import_as_fc(gis, df, **kwargs)
    298         postdata["analyzeParameters"]["locationType"] = "address"
    299 
--> 300     res = gis._con._session.post(path, postdata)
    301 
    302     # Step 2: Prep parameters to generate features

~\Anaconda3\envs\arcgis_220_py311\Lib\site-packages\arcgis\auth\api.py in post(self, url, data, json, **kwargs)
    523         else:
    524             redirects = self.allow_redirects
--> 525         return self._session.post(
    526             url,
    527             data=data,

~\Anaconda3\envs\arcgis_220_py311\Lib\site-packages\requests\sessions.py in post(self, url, data, json, **kwargs)
    635         """
    636 
--> 637         return self.request("POST", url, data=data, json=json, **kwargs)
    638 
    639     def put(self, url, data=None, **kwargs):

~\Anaconda3\envs\arcgis_220_py311\Lib\site-packages\requests\sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
    573             hooks=hooks,
    574         )
--> 575         prep = self.prepare_request(req)
    576 
    577         proxies = proxies or {}

~\Anaconda3\envs\arcgis_220_py311\Lib\site-packages\requests\sessions.py in prepare_request(self, request)
    484 
    485         p = PreparedRequest()
--> 486         p.prepare(
    487             method=request.method.upper(),
    488             url=request.url,

~\Anaconda3\envs\arcgis_220_py311\Lib\site-packages\requests\models.py in prepare(self, method, url, headers, files, data, params, auth, cookies, hooks, json)
    366 
    367         self.prepare_method(method)
--> 368         self.prepare_url(url, params)
    369         self.prepare_headers(headers)
    370         self.prepare_cookies(cookies)

~\Anaconda3\envs\arcgis_220_py311\Lib\site-packages\requests\models.py in prepare_url(self, url, params)
    437 
    438         if not scheme:
--> 439             raise MissingSchema(
    440                 f"Invalid URL {url!r}: No scheme supplied. "
    441                 f"Perhaps you meant [https://{url}?"](https://%7Burl%7D/?%22)

MissingSchema: Invalid URL 'content/features/analyze': No scheme supplied. Perhaps you meant https://content/features/analyze?

@achapkowski or @nanaeaubry Could either of you please take a look, or forward to someone relevant? Thanks!

@CMPeng CMPeng added the bug label Sep 14, 2023
@nanaeaubry nanaeaubry self-assigned this Sep 14, 2023
@CMPeng
Copy link
Contributor Author

CMPeng commented Sep 15, 2023

Hey @nanaeaubry
I tested with the latest merged source codes, now the import_data works for older enterprise; however, for online (production and devext), and the newest enterprise, it still failed. By failing, I meant it has imported 0 features... (rather than 230 features in the DF).
image
Can you please check again to see why importing failed for online (and etc.)? Thanks a lot! CC @achapkowski

@CMPeng CMPeng reopened this Sep 15, 2023
@nanaeaubry
Copy link
Contributor

@CMPeng This is reproducible at 2.1.0.3 and 2.1.0.2 already. I didn't check before those versions. Do you know when was the last version something was returned?

0 features are returned because 230 features are rejected during the geocoding part of the import data method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants